File: README.md

package info (click to toggle)
rust-byteorder-slice 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 176 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 554 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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.

```rust
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();
```