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

#1796 in Rust patterns

Download history 7389/week @ 2024-07-22 7252/week @ 2024-07-29 6457/week @ 2024-08-05 6244/week @ 2024-08-12 5835/week @ 2024-08-19 7599/week @ 2024-08-26 7015/week @ 2024-09-02 6162/week @ 2024-09-09 5730/week @ 2024-09-16 6636/week @ 2024-09-23 5979/week @ 2024-09-30 7059/week @ 2024-10-07 7656/week @ 2024-10-14 7938/week @ 2024-10-21 8358/week @ 2024-10-28 8143/week @ 2024-11-04

32,190 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