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

..--

.github/workflows/23-Nov-2023-152130

benches/23-Nov-2023-325294

src/23-Nov-2023-5,6462,734

.cargo_vcs_info.jsonD23-Nov-202374 65

.gitignoreD23-Nov-202340

Android.bpD23-Nov-20231.7 KiB5248

CHANGELOG.mdD23-Nov-20234.6 KiB140105

COPYINGD23-Nov-2023126 42

Cargo.tomlD23-Nov-20231.3 KiB4439

Cargo.toml.origD23-Nov-2023979 3529

LICENSED23-Nov-20231.1 KiB2217

LICENSE-MITD23-Nov-20231.1 KiB2217

METADATAD23-Nov-2023411 2019

MODULE_LICENSE_MITD23-Nov-20230

OWNERSD23-Nov-202340 21

README.mdD23-Nov-20231.6 KiB6443

UNLICENSED23-Nov-20231.2 KiB2520

rustfmt.tomlD23-Nov-202344 32

README.md

1byteorder
2=========
3This crate provides convenience methods for encoding and decoding
4numbers in either big-endian or little-endian order.
5
6[![Build status](https://github.com/BurntSushi/byteorder/workflows/ci/badge.svg)](https://github.com/BurntSushi/byteorder/actions)
7[![](https://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder)
8
9Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
10
11
12### Documentation
13
14https://docs.rs/byteorder
15
16
17### Installation
18
19This crate works with Cargo and is on
20[crates.io](https://crates.io/crates/byteorder). Add it to your `Cargo.toml`
21like so:
22
23```toml
24[dependencies]
25byteorder = "1"
26```
27
28If you want to augment existing `Read` and `Write` traits, then import the
29extension methods like so:
30
31```rust
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