@@ -22,6 +22,11 @@ use std::sync::Arc;
22
22
/// be processed or ignored, whichever is appropriate. Then they should provide
23
23
/// a `finish` method that finishes up encoding. If the encoder is fallible,
24
24
/// `finish` should return a `Result` that indicates success or failure.
25
+ ///
26
+ /// This current does not support `f32` nor `f64`, as they're not needed in any
27
+ /// serialized data structures. That could be changed, but consider whether it
28
+ /// really makes sense to store floating-point values at all.
29
+ /// (If you need it, revert <https://github.com/rust-lang/rust/pull/109984>.)
25
30
pub trait Encoder {
26
31
// Primitive types:
27
32
fn emit_usize ( & mut self , v : usize ) ;
@@ -37,8 +42,6 @@ pub trait Encoder {
37
42
fn emit_i16 ( & mut self , v : i16 ) ;
38
43
fn emit_i8 ( & mut self , v : i8 ) ;
39
44
fn emit_bool ( & mut self , v : bool ) ;
40
- fn emit_f64 ( & mut self , v : f64 ) ;
41
- fn emit_f32 ( & mut self , v : f32 ) ;
42
45
fn emit_char ( & mut self , v : char ) ;
43
46
fn emit_str ( & mut self , v : & str ) ;
44
47
fn emit_raw_bytes ( & mut self , s : & [ u8 ] ) ;
@@ -58,6 +61,11 @@ pub trait Encoder {
58
61
// top-level invocation would also just panic on failure. Switching to
59
62
// infallibility made things faster and lots of code a little simpler and more
60
63
// concise.
64
+ ///
65
+ /// This current does not support `f32` nor `f64`, as they're not needed in any
66
+ /// serialized data structures. That could be changed, but consider whether it
67
+ /// really makes sense to store floating-point values at all.
68
+ /// (If you need it, revert <https://github.com/rust-lang/rust/pull/109984>.)
61
69
pub trait Decoder {
62
70
// Primitive types:
63
71
fn read_usize ( & mut self ) -> usize ;
@@ -73,8 +81,6 @@ pub trait Decoder {
73
81
fn read_i16 ( & mut self ) -> i16 ;
74
82
fn read_i8 ( & mut self ) -> i8 ;
75
83
fn read_bool ( & mut self ) -> bool ;
76
- fn read_f64 ( & mut self ) -> f64 ;
77
- fn read_f32 ( & mut self ) -> f32 ;
78
84
fn read_char ( & mut self ) -> char ;
79
85
fn read_str ( & mut self ) -> & str ;
80
86
fn read_raw_bytes ( & mut self , len : usize ) -> & [ u8 ] ;
@@ -143,8 +149,6 @@ direct_serialize_impls! {
143
149
i64 emit_i64 read_i64,
144
150
i128 emit_i128 read_i128,
145
151
146
- f32 emit_f32 read_f32,
147
- f64 emit_f64 read_f64,
148
152
bool emit_bool read_bool,
149
153
char emit_char read_char
150
154
}
0 commit comments