MCPcopy Index your code
hub / github.com/BurntSushi/byteorder

github.com/BurntSushi/byteorder @1.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.5.0 ↗ · + Follow
144 symbols 164 edges 3 files 16 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

byteorder

This crate provides convenience methods for encoding and decoding numbers in either big-endian or little-endian order.

Build status crates.io

Dual-licensed under MIT or the UNLICENSE.

Documentation

https://docs.rs/byteorder

Installation

This crate works with Cargo and is on crates.io. Add it to your Cargo.toml like so:

[dependencies]
byteorder = "1"

If you want to augment existing Read and Write traits, then import the extension methods like so:

use byteorder::{ReadBytesExt, WriteBytesExt, BigEndian, LittleEndian};

For example:

use std::io::Cursor;
use byteorder::{BigEndian, ReadBytesExt};

let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
// Note that we use type parameters to indicate which kind of byte order
// we want!
assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());

no_std crates

This crate has a feature, std, that is enabled by default. To use this crate in a no_std context, add the following to your Cargo.toml:

[dependencies]
byteorder = { version = "1", default-features = false }

Minimum Rust version policy

This crate's minimum supported rustc version is 1.60.0.

The current policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if crate 1.0 requires Rust 1.20.0, then crate 1.0.z for all values of z will also require Rust 1.20.0 or newer. However, crate 1.y for y > 0 may require a newer minimum version of Rust.

In general, this crate will be conservative with respect to the minimum supported version of Rust.

Alternatives

Note that as of Rust 1.32, the standard numeric types provide built-in methods like to_le_bytes and from_le_bytes, which support some of the same use cases.

Extension points exported contracts — how you extend this code

Sealed (Interface)
Sealed stops crates other than byteorder from implementing any traits that use it. [2 implementers]
src/lib.rs
ReadBytesExt (Interface)
Extends [`Read`] with methods for reading numbers. (For `std::io`.) Most of the methods defined here have an unconstrai [1 …
src/io.rs
ByteOrder (Interface)
`ByteOrder` describes types that can serialize integers as bytes. Note that `Self` does not appear anywhere in this tra [2 …
src/lib.rs
WriteBytesExt (Interface)
Extends [`Write`] with methods for writing numbers. (For `std::io`.) Most of the methods defined here have an unconstra [1 …
src/io.rs

Core symbols most depended-on inside this repo

slice_to_u8_mut
called by 11
src/io.rs
extend_sign
called by 1
src/lib.rs
extend_sign128
called by 1
src/lib.rs
unextend_sign
called by 1
src/lib.rs
unextend_sign128
called by 1
src/lib.rs
pack_size
called by 0
src/lib.rs
pack_size128
called by 0
src/lib.rs
read_u24
called by 0
src/lib.rs

Shape

Method 126
Function 11
Interface 4
Enum 2
Class 1

Languages

Rust100%

Modules by API surface

src/lib.rs88 symbols
src/io.rs56 symbols

For agents

$ claude mcp add byteorder \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact