• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

benches/H03-May-2022-329297

src/H03-May-2022-4,9722,070

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D07-Feb-202074 65

.gitignoreH A D09-Jul-201640 76

.travis.ymlH A D22-Feb-2018278 1615

CHANGELOG.mdH A D19-Jan-20194 KiB11588

COPYINGH A D09-Jul-2016126 42

Cargo.tomlH A D07-Feb-20201.4 KiB4943

Cargo.toml.orig-cargoH A D07-Feb-20201 KiB3932

LICENSE-MITH A D09-Jul-20161.1 KiB2217

README.mdH A D09-Jun-20191.6 KiB6442

UNLICENSEH A D09-Jul-20161.2 KiB2520

build.rsH A D07-Feb-20202.3 KiB9177

README.md

1This crate provides convenience methods for encoding and decoding
2numbers in either big-endian or little-endian order.
3
4[![Build status](https://api.travis-ci.org/BurntSushi/byteorder.svg)](https://travis-ci.org/BurntSushi/byteorder)
5[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder)
6
7Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
8
9
10### Documentation
11
12https://docs.rs/byteorder
13
14
15### Installation
16
17This crate works with Cargo and is on
18[crates.io](https://crates.io/crates/byteorder). Add it to your `Cargo.toml`
19like so:
20
21```toml
22[dependencies]
23byteorder = "1"
24```
25
26If you want to augment existing `Read` and `Write` traits, then import the
27extension methods like so:
28
29```rust
30extern crate byteorder;
31
32use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian};
33```
34
35For example:
36
37```rust
38use std::io::Cursor;
39use byteorder::{BigEndian, ReadBytesExt};
40
41let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
42// Note that we use type parameters to indicate which kind of byte order
43// we want!
44assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
45assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
46```
47
48### `no_std` crates
49
50This crate has a feature, `std`, that is enabled by default. To use this crate
51in a `no_std` context, add the following to your `Cargo.toml`:
52
53```toml
54[dependencies]
55byteorder = { version = "1", default-features = false }
56```
57
58
59### Alternatives
60
61Note that as of Rust 1.32, the standard numeric types provide built-in methods
62like `to_le_bytes` and `from_le_bytes`, which support some of the same use
63cases.
64