6 releases (3 major breaking)

3.0.0 Jul 28, 2022
2.0.0 Nov 27, 2021
1.0.0 Nov 27, 2021
0.3.0 Nov 21, 2021
0.1.0 Oct 4, 2019

#6 in #byteorder

Download history 5700/week @ 2024-06-19 5596/week @ 2024-06-26 5946/week @ 2024-07-03 6705/week @ 2024-07-10 7714/week @ 2024-07-17 7135/week @ 2024-07-24 6886/week @ 2024-07-31 6495/week @ 2024-08-07 5905/week @ 2024-08-14 6561/week @ 2024-08-21 6771/week @ 2024-08-28 7261/week @ 2024-09-04 6336/week @ 2024-09-11 5805/week @ 2024-09-18 6833/week @ 2024-09-25 4636/week @ 2024-10-02

24,734 downloads per month
Used in 16 crates (via pcap-file)

MIT license

19KB
476 lines

byteorder_slice

Provides convenience methods for reading numbers and slices from a slice

Usage

Use byteorder_slice = "1.0.0" if you want reads to return an Option.

Use byteorder_slice = "2.0.0" if you want reads to return a std::io::Result.

use byteorder_slice::{BigEndian, LittleEndian, ReadSlice}
let data = vec![0_u8; 100];
let src = &mut &data[..];

let a = src.read_u8().unwrap();
let b = src.read_u32::<BigEndian>().unwrap();
let c = src.read_uint::<LittleEndian>(3).unwrap();
let d = src.read_slice(10).unwrap();

Dependencies

~115KB