pub struct BitPack<B> { /* private fields */ }
Implementations§
Source§impl<'a> BitPack<&'a mut [u8]>
impl<'a> BitPack<&'a mut [u8]>
Sourcepub fn write(&mut self, value: u32, bits: usize) -> Result<(), usize>
pub fn write(&mut self, value: u32, bits: usize) -> Result<(), usize>
use bitpack::BitPack;
let mut buff = [0; 2];
{
let mut bitpack = BitPack::<&mut [u8]>::new(&mut buff);
bitpack.write(10, 4).unwrap();
bitpack.write(1021, 10).unwrap();
bitpack.write(3, 2).unwrap();
}
assert_eq!(buff, [218, 255]);
Trait Implementations§
impl<B: Eq> Eq for BitPack<B>
impl<B> StructuralPartialEq for BitPack<B>
Auto Trait Implementations§
impl<B> Freeze for BitPack<B>where
B: Freeze,
impl<B> RefUnwindSafe for BitPack<B>where
B: RefUnwindSafe,
impl<B> Send for BitPack<B>where
B: Send,
impl<B> Sync for BitPack<B>where
B: Sync,
impl<B> Unpin for BitPack<B>where
B: Unpin,
impl<B> UnwindSafe for BitPack<B>where
B: 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