File tree 6 files changed +54
-1
lines changed
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.
4
4
The format is based on [ Keep a Changelog] , and this project adheres to
5
5
[ Semantic Versioning] .
6
6
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
+
7
20
## [ 0.2.0] - 2024-11-05
8
21
9
22
### Added
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " parsenic"
3
- version = " 0.2.0 "
3
+ version = " 0.2.1 "
4
4
edition = " 2021"
5
5
license = " Apache-2.0 OR BSL-1.0 OR MIT"
6
6
description = " 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 {
44
44
fn i128 ( & mut self ) -> LenResult < i128 > {
45
45
Ok ( i128:: from_be_bytes ( self . array ( ) ?) )
46
46
}
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
+ }
47
57
}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Write: crate::Write {
44
44
fn i128 ( & mut self , int : i128 ) -> FullResult {
45
45
self . bytes ( int. to_be_bytes ( ) )
46
46
}
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
+ }
47
57
}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Read: crate::Read {
44
44
fn i128 ( & mut self ) -> LenResult < i128 > {
45
45
Ok ( i128:: from_le_bytes ( self . array ( ) ?) )
46
46
}
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
+ }
47
57
}
Original file line number Diff line number Diff line change @@ -44,4 +44,14 @@ pub trait Write: crate::Write {
44
44
fn i128 ( & mut self , int : i128 ) -> FullResult {
45
45
self . bytes ( int. to_le_bytes ( ) )
46
46
}
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
+ }
47
57
}
You can’t perform that action at this time.
0 commit comments