Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
.github/workflows/ | 03-May-2024 | - | 152 | 130 | ||
benches/ | 03-May-2024 | - | 325 | 294 | ||
src/ | 03-May-2024 | - | 5,646 | 2,734 | ||
.cargo_vcs_info.json | D | 03-May-2024 | 74 | 6 | 5 | |
.gitignore | D | 03-May-2024 | 40 | 7 | 6 | |
Android.bp | D | 03-May-2024 | 1.7 KiB | 52 | 48 | |
CHANGELOG.md | D | 03-May-2024 | 4.6 KiB | 140 | 105 | |
COPYING | D | 03-May-2024 | 126 | 4 | 2 | |
Cargo.toml | D | 03-May-2024 | 1.3 KiB | 44 | 39 | |
Cargo.toml.orig | D | 03-May-2024 | 979 | 35 | 29 | |
LICENSE | D | 03-May-2024 | 1.1 KiB | 22 | 17 | |
LICENSE-MIT | D | 03-May-2024 | 1.1 KiB | 22 | 17 | |
METADATA | D | 03-May-2024 | 411 | 20 | 19 | |
MODULE_LICENSE_MIT | D | 03-May-2024 | 0 | |||
OWNERS | D | 03-May-2024 | 40 | 2 | 1 | |
README.md | D | 03-May-2024 | 1.6 KiB | 64 | 43 | |
UNLICENSE | D | 03-May-2024 | 1.2 KiB | 25 | 20 | |
rustfmt.toml | D | 03-May-2024 | 44 | 3 | 2 |
README.md
1byteorder 2========= 3This crate provides convenience methods for encoding and decoding 4numbers in either big-endian or little-endian order. 5 6[](https://github.com/BurntSushi/byteorder/actions) 7[](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