Debian Codegraph @

.cargo/vendor/byteorder/README.md

raw
1 byteorder
2 =========
3 This crate provides convenience methods for encoding and decoding
4 numbers 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 [![crates.io](https://img.shields.io/crates/v/byteorder.svg)](https://crates.io/crates/byteorder)
8
9 Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
10
11
12 ### Documentation
13
14 https://docs.rs/byteorder
15
16
17 ### Installation
18
19 This crate works with Cargo and is on
20 [crates.io](https://crates.io/crates/byteorder). Add it to your `Cargo.toml`
21 like so:
22
23 ```toml
24 [dependencies]
25 byteorder = "1"
26 ```
27
28 If you want to augment existing `Read` and `Write` traits, then import the
29 extension methods like so:
30
31 ```rust
32 use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian};
33 ```
34
35 For example:
36
37 ```rust
38 use std::io::Cursor;
39 use byteorder::{BigEndian, ReadBytesExt};
40
41 let 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!
44 assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
45 assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
46 ```
47
48 ### `no_std` crates
49
50 This crate has a feature, `std`, that is enabled by default. To use this crate
51 in a `no_std` context, add the following to your `Cargo.toml`:
52
53 ```toml
54 [dependencies]
55 byteorder = { version = "1", default-features = false }
56 ```
57
58
59 ### Minimum Rust version policy
60
61 This crate's minimum supported `rustc` version is `1.60.0`.
62
63 The current policy is that the minimum Rust version required to use this crate
64 can be increased in minor version updates. For example, if `crate 1.0` requires
65 Rust 1.20.0, then `crate 1.0.z` for all values of `z` will also require Rust
66 1.20.0 or newer. However, `crate 1.y` for `y > 0` may require a newer minimum
67 version of Rust.
68
69 In general, this crate will be conservative with respect to the minimum
70 supported version of Rust.
71
72
73 ### Alternatives
74
75 Note that as of Rust 1.32, the standard numeric types provide built-in methods
76 like `to_le_bytes` and `from_le_bytes`, which support some of the same use
77 cases.