pub struct Layout {
pub bit: BitOrder,
pub byte: ByteOrder,
}Expand description
The wire layout: bit packing order and byte order, threaded through the
cursors and entry points. #[bin(big|little)] and #[bin(bits = msb|lsb)]
set it; the default is MSB-first, big-endian (RFC/network order).
§Examples
use bnb::{BitReader, BitOrder, ByteOrder, Layout};
// Read a 16-bit value little-endian instead of the default big-endian.
let layout = Layout { bit: BitOrder::Msb, byte: ByteOrder::Little };
let mut r = BitReader::with_layout(&[0x34, 0x12], layout);
assert_eq!(r.read::<u16>().unwrap(), 0x1234);
assert_eq!(Layout::default(), Layout { bit: BitOrder::Msb, byte: ByteOrder::Big });Fields§
§bit: BitOrderBit packing order — does the first bit land in the high or low bit.
byte: ByteOrderByte order, applied to byte-multiple values.
Trait Implementations§
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layout
impl UnwindSafe for Layout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more