A Rust library for reading and writing numbers in big-endian and little-endian byte order.
byteorder is a Rust library that provides methods for reading and writing numbers in big-endian and little-endian byte order. It solves the problem of handling binary data with different byte orders, which is common in network protocols, file formats, and low-level systems programming.
Rust developers working with binary data, network protocols, file parsing, or embedded systems where control over byte order is required.
It offers a type-safe, efficient, and convenient API that extends Rust's standard I/O traits, making it easier to work with byte order than using manual bit manipulation or built-in methods like `to_le_bytes`.
Rust library for reading/writing numbers in big-endian and little-endian.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Rust generics to specify byte order at compile time, preventing runtime errors and ensuring correctness in binary data handling, as shown in the example with `rdr.read_u16::<BigEndian>()`.
Extends `Read` and `Write` traits with methods like `read_u16` and `write_i32`, simplifying reading and writing numbers from streams without manual buffer management.
Can be used in embedded or no_std environments by disabling the default `std` feature, making it versatile for low-level systems programming.
Supports all standard integer and floating-point types, as highlighted in the features, ensuring it handles diverse binary formats.
Since Rust 1.32, built-in methods like `to_le_bytes` provide similar functionality for standalone conversions, reducing the crate's necessity in projects without I/O needs.
Adding byteorder might be overkill for simple tasks, such as occasional byte order swaps, where native methods or manual code could avoid an extra dependency.
The crate's policy allows increasing the minimum Rust version in minor updates, which could cause breaking changes for teams stuck on older toolchains.