byteorder_slice

Crates.iobyteorder_slice
lib.rsbyteorder_slice
version3.0.0
sourcesrc
created_at2019-10-04 09:07:13.020559
updated_at2022-07-28 13:33:02.933957
descriptionByteorder like crate for &[u8]
homepage
repositoryhttps://github.com/courvoif/byteorder_slice
max_upload_size
id169810
size46,595
courvoif (courvoif)

documentation

https://docs.rs/byteorder_slice/

README

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();
Commit count: 15

cargo fmt