forked from dermesser/integer-encoding-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
42 lines (36 loc) · 1.09 KB
/
lib.rs
File metadata and controls
42 lines (36 loc) · 1.09 KB
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
//! Fast serialization of integers.
//!
//! ```
//! use integer_encoding::*;
//!
//! fn main() {
//! let a: u32 = 344;
//! let encoded_byte_slice = a.encode_fixed_light();
//! assert_eq!(a, u32::decode_fixed(encoded_byte_slice));
//! assert_eq!(4, encoded_byte_slice.len());
//!
//! let b: i32 = -111;
//! let encoded_byte_vec = b.encode_var_vec();
//! assert_eq!(Some((b, 2)), i32::decode_var(&encoded_byte_vec));
//! }
//! ```
mod fixed;
mod fixed_tests;
mod varint;
mod varint_tests;
mod reader;
mod writer;
pub use fixed::FixedInt;
pub use varint::VarInt;
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
pub use reader::FixedIntAsyncReader;
pub use reader::FixedIntReader;
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
pub use reader::VarIntAsyncReader;
pub use reader::VarIntReader;
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
pub use writer::FixedIntAsyncWriter;
pub use writer::FixedIntWriter;
#[cfg(any(feature = "tokio_async", feature = "futures_async"))]
pub use writer::VarIntAsyncWriter;
pub use writer::VarIntWriter;