🧮 futures-byteorder
Modern async byteorder library for smol/futures-lite
This crate provides utilities for reading and writing numbers in big-endian and little-endian byte
order for async I/O streams. It's designed as a lightweight alternative to byteorder with
first-class async support and zero proc-macro dependencies
Quick start
[]
= "0.1"
Reading
use ;
use Cursor;
let data = vec!;
let mut reader = new;
// Read a big-endian u16
let value = reader..await?;
assert_eq!;
// Read using native endianness
let value = reader.read_u16_ne.await?;
Writing
use ;
use Cursor;
let mut buffer = Vecnew;
let mut writer = new;
writer..await?; // Write a little-endian u32
writer.write_u16_ne.await?; // Write using native endianness
Endianness types
BigEndian(BE) - Network byte orderLittleEndian(LE) - x86 byte orderNativeEndian(NE) - Platform nativeNetworkEndian- Alias forBE
Supported types
All primitive numeric types: u8-u128, i8-i128, f32, f64
Why futures-byteorder?
The original byteorder crate is excellent, but predates async/await. This crate provides:
- Native async support with
futures-lite - Designed for the smol ecosystem
- Basically zero dependencies
- Modern, clean API built for async from the ground up
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.