pub enum EndianValue<T>where
T: SpecificEndian<T>,{
Big(BigEndian<T>),
Little(LittleEndian<T>),
}Available on crate feature
io-core only.Expand description
Read raw bytes into a BigEndian<T>.
Short helper; avoids _be/_le in the public API name.
Example:
ⓘ
use simple_endian::io::core_io;
let data: [u8; 2] = [0x12, 0x34];
let be: simple_endian::BigEndian<u16> = core_io::from_bytes(&data).unwrap();
assert_eq!(be.to_native(), 0x1234u16);Zero-allocation enum that holds either a BigEndian<T> or
LittleEndian<T> value. This replaces an earlier boxed trait-based
approach to avoid heap allocation.
Variants§
Big(BigEndian<T>)
Little(LittleEndian<T>)
Implementations§
Source§impl<T> EndianValue<T>where
T: SpecificEndian<T> + Copy,
impl<T> EndianValue<T>where
T: SpecificEndian<T> + Copy,
Auto Trait Implementations§
impl<T> Freeze for EndianValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for EndianValue<T>where
T: RefUnwindSafe,
impl<T> Send for EndianValue<T>where
T: Send,
impl<T> Sync for EndianValue<T>where
T: Sync,
impl<T> Unpin for EndianValue<T>where
T: Unpin,
impl<T> UnwindSafe for EndianValue<T>where
T: UnwindSafe,
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