Expand description
§Bits & Bobs. No-std/No-alloc bit/byte manipulation of streams.
The main traits provided by this crate are Bits (analogous to std::io::Read),
and MutBits (analogous to std::io::Write).
Also included are multi-OS wrappers SeekRead and SeekWrite, and a
more organic UTF-8 encoding/decoding setup for chars.
This is an Irox foundational crate, it has no external dependencies, is no-std/no-alloc by
default (but can be augmented by using the std and alloc features), and many other irox
crates extend and augment the functionality contained herein. [irox_structs] is notable as
it provides a derivable way to encode/decode structs as a sequence of bytes.
§Features
alloc:- Enables the implementation of
BitsandMutBitson the types from thealloccrate: - Enables the following additional methods:
Bits::read_u8_blob()->Vec<u8>Bits::read_be_u16_blob()/Bits::read_le_u16_blob()->Vec<u16>Bits::read_be_u32_blob()/Bits::read_le_u32_blob()->Vec<u32>Bits::read_be_u64_blob()/Bits::read_le_u64_blob()->Vec<u64>Bits::read_all_vec()->Vec<u8>Bits::read_exact_vec()->Vec<u8>Bits::read_all_str_lossy()->alloc::string::StringBits::read_str_sized_lossy()->alloc::string::StringBits::read_str_u32_blob()->alloc::string::StringBits::read_until()->Vec<u8>Bits::consume_until()->()
- Enables the implementation of
std:- Enables the implementation of
BitsandMutBitson the types from thestdcrate: - Also enables the
SeekReadandSeekWritetraits, which wrap and normalize:- [
std::os::windows::fs::FileExt::seek_read] and [std::os::windows::fs::FileExt::seek_write] - [
std::os::unix::fs::FileExt:read_at] andstd::os::unix::fs::FileExt::write_at
- [
- Enables the implementation of
Modules§
- UTF-8 Encoding & Decoding
Structs§
- This struct wraps a provided borrowed static array in a MutBits impl. Operates like a slice, walking through the array filling it up.
- Error returned from the various Bits methods.
- Wraps a borrowed
MutBits, providing an implementation ofcore::fmt::Writeto permit the use of thecore::write!macro with a target of&mutMutBits - This struct wraps a provided borrowed static array in a MutBits impl. Operates like a slice, walking through the array filling it up.
Enums§
- Enum originally modelled after
std::io::ErrorKind, used to indicate the type of the error encountered. - Wraps a borrowed value and provides implementations of [
Bits] and [MutBits] where applicable.
Traits§
- Read methods for the primitive types
- Converts to the value from a constant number of bytes
- Write methods for the primitive types
- Trait to permit an atomic Seek+Read operation
- Trait to permit an atomic Seek+Write operation
- Converts the value into a constant number of bytes
- Writes ‘self’ to the provided
MutBitsimpl in big endian order.
Functions§
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Splits the input into two equal sized arrays.
- Calls
Bits::read_be_u32(). Provided for type-elusion purposes. - Calls
Bits::read_be_u64(). Provided for type-elusion purposes. - Calls
Bits::read_f32(). Provided for type-elusion purposes. - Calls
Bits::read_f64(). Provided for type-elusion purposes.
Type Aliases§
- Type alias to
BitsError - Type alias to
BitsErrorKind