5 releases

0.4.3 Oct 16, 2024
0.4.2 Oct 14, 2024
0.4.0 Sep 22, 2024
0.3.5 Sep 21, 2024
0.1.8 Sep 19, 2024

#1895 in Encoding

Download history 583/week @ 2024-09-14 723/week @ 2024-09-21 28/week @ 2024-09-28 29/week @ 2024-10-05 690/week @ 2024-10-12 220/week @ 2024-10-19 102/week @ 2024-10-26 81/week @ 2024-11-02 28/week @ 2024-11-09 9/week @ 2024-11-16 1/week @ 2024-11-23

129 downloads per month

MIT license

22KB
485 lines

le-stream

Serialize and deserialize object to/from little-endian byte streams.

Example

use le_stream::{FromLeStream, ToLeStream};

fn main() {
    let i: i32 = 1234;
    let bytes: [u8; 4] = [0xd2, 0x04, 0x00, 0x00];

    for (byte, target) in i.to_le_stream().zip(bytes) {
        assert_eq!(byte, target);
    }

    let bytes: [u8; 4] = [0xd2, 0x04, 0x00, 0x00];
    let target: i32 = 1234;
    assert_eq!(i32::from_le_stream(&mut bytes.into_iter()), Some(target));
}

Contribution guidelines

  • Use cargo fmt
  • Check code with cargo clippy

lib.rs:

A library for reading and writing data in little-endian byte order.

Dependencies

~580KB
~12K SLoC