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
//! # T-Bytes
//!
//! T-Bytes is a tiny library for reading and writing typed data into bytes buffers. It is designed
//! mainly for `no-std`, `no-alloc` targets or crates which consider to support for `no-std`.
//!
//! # Usage
//!
//! It would be easier to start from an example:
//!
//! ```rust
//! use tbytes::{TBytesReader, TBytesReaderFor};
//!
//! let buffer = [128, 255, 1, 1u8, 1, 255];
//! let reader = TBytesReader::from(buffer.as_slice());
//!
//! // Read byte as `u8`
//! let val: u8 = reader.read().unwrap();
//! assert_eq!(val, 128);
//!
//! // Read byte as `i8`
//! let val: i8 = reader.read().unwrap();
//! assert_eq!(val, -1);
//!
//! // Read two bytes as `u16`
//! let val: u16 = reader.read().unwrap();
//! assert_eq!(val, 257);
//!
//! // Read two bytes as `u8` array
//! let val: [u8; 2] = reader.read_array().unwrap();
//! assert_eq!(val, [1, 255]);
//! ```
//!
//! # Limitations
//!
//! * We currently supports only numeric types.
//! * At the moment only `little endian` is supported.
pub use ;
pub use ;