File tree Expand file tree Collapse file tree 6 files changed +54
-1
lines changed Expand file tree Collapse file tree 6 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,19 @@ All notable changes to `parsenic` will be documented in this file.
44The format is based on [ Keep a Changelog] , and this project adheres to
55[ Semantic Versioning] .
66
7+ ## [ 0.2.1] - 2024-11-16
8+
9+ ### Added
10+
11+ - ` le::Read::f32() `
12+ - ` le::Read::f64() `
13+ - ` le::Write::f32() `
14+ - ` le::Write::f64() `
15+ - ` be::Read::f32() `
16+ - ` be::Read::f64() `
17+ - ` be::Write::f32() `
18+ - ` be::Write::f64() `
19+
720## [ 0.2.0] - 2024-11-05
821
922### Added
Original file line number Diff line number Diff line change 11[package ]
22name = " parsenic"
3- version = " 0.2.0 "
3+ version = " 0.2.1 "
44edition = " 2021"
55license = " Apache-2.0 OR BSL-1.0 OR MIT"
66description = " A simple no-std/no-alloc I/O and parsing crate"
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Read: crate::Read {
4444 fn i128 ( & mut self ) -> LenResult < i128 > {
4545 Ok ( i128:: from_be_bytes ( self . array ( ) ?) )
4646 }
47+
48+ /// Read the next big endian `f32`
49+ fn f32 ( & mut self ) -> LenResult < f32 > {
50+ Ok ( f32:: from_be_bytes ( self . array ( ) ?) )
51+ }
52+
53+ /// Read the next big endian `f64`
54+ fn f64 ( & mut self ) -> LenResult < f64 > {
55+ Ok ( f64:: from_be_bytes ( self . array ( ) ?) )
56+ }
4757}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Write: crate::Write {
4444 fn i128 ( & mut self , int : i128 ) -> FullResult {
4545 self . bytes ( int. to_be_bytes ( ) )
4646 }
47+
48+ /// Write out a big endian encoded 32-bit float.
49+ fn f32 ( & mut self , float : f32 ) -> FullResult {
50+ self . bytes ( float. to_be_bytes ( ) )
51+ }
52+
53+ /// Write out a big endian encoded 64-bit float.
54+ fn f64 ( & mut self , float : f64 ) -> FullResult {
55+ self . bytes ( float. to_be_bytes ( ) )
56+ }
4757}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Read: crate::Read {
4444 fn i128 ( & mut self ) -> LenResult < i128 > {
4545 Ok ( i128:: from_le_bytes ( self . array ( ) ?) )
4646 }
47+
48+ /// Read the next little endian `f32`
49+ fn f32 ( & mut self ) -> LenResult < f32 > {
50+ Ok ( f32:: from_le_bytes ( self . array ( ) ?) )
51+ }
52+
53+ /// Read the next little endian `f64`
54+ fn f64 ( & mut self ) -> LenResult < f64 > {
55+ Ok ( f64:: from_le_bytes ( self . array ( ) ?) )
56+ }
4757}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Write: crate::Write {
4444 fn i128 ( & mut self , int : i128 ) -> FullResult {
4545 self . bytes ( int. to_le_bytes ( ) )
4646 }
47+
48+ /// Write out a little endian encoded 32-bit float.
49+ fn f32 ( & mut self , float : f32 ) -> FullResult {
50+ self . bytes ( float. to_le_bytes ( ) )
51+ }
52+
53+ /// Write out a little endian encoded 64-bit float.
54+ fn f64 ( & mut self , float : f64 ) -> FullResult {
55+ self . bytes ( float. to_le_bytes ( ) )
56+ }
4757}
You can’t perform that action at this time.
0 commit comments