1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! # Number Encoding
//!
//! ## How to Use
//!
//! Run `cargo add encoder`
//!
//! Put trait in your code `use encoder::number::Encode;`
//!
//! ## Integer encoding
//!
//! Support i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize, bool
//!
//! ```
//! use encoder::number::Encode;
//!
//! fn main() {
//! let mut buf = vec![];
//! 12345.encode(&mut buf);
//! 67890.encode(&mut buf);
//! println!("{}", String::from_utf8_lossy(&buf));
//!
//! println!("{}", 12345.stringify());
//! println!("{}", 67890.stringify());
//! }
//! ```
//!
//! ## Floating point encoding
//!
//! Support f32 and f64
//!
//! ```
//! use encoder::number::Encode;
//!
//! fn main() {
//! let mut buf = vec![];
//! std::f32::consts::PI.encode(&mut buf);
//! buf.push(b'\n');
//! std::f64::consts::PI.encode(&mut buf);
//! println!("{}", String::from_utf8_lossy(&buf));
//!
//! println!("{}", std::f32::consts::PI.stringify());
//! println!("{}", std::f64::consts::PI.stringify());
//! }
//! ```
//!
//! **Happy encoding!**
/// The Encode Trait