pub struct BitEstream { /* private fields */ }
Implementations§
Source§impl BitEstream
impl BitEstream
Sourcepub fn new() -> Self
pub fn new() -> Self
Replace the original BIT_initCStream Return a new BitCstream, the vector should be already allocated with a given capacity in byte
Sourcepub fn add_bits<T: Into<usize>>(&mut self, value: T, nb_bits: u8) -> Result<()>
pub fn add_bits<T: Into<usize>>(&mut self, value: T, nb_bits: u8) -> Result<()>
Add since CTNR_SIZE
bits into stream bit_container
.
Note : does not check for register overflow !
Sourcepub fn unchecked_add_bits(&mut self, value: usize, nb_bits: u8) -> Result<()>
pub fn unchecked_add_bits(&mut self, value: usize, nb_bits: u8) -> Result<()>
Add bits without masking checking the higher it of the value
work only if you’re sur that the bits higher than the nb_bits
are 0. The result is undefined otherwise!
Note: It’s not really faster anyway
Sourcepub fn flush_bits(&mut self)
pub fn flush_bits(&mut self)
Sourcepub fn close_stream(&mut self) -> Result<()>
pub fn close_stream(&mut self) -> Result<()>
Flush remainings bits from the container with an endMark.
§Return
Total size of the stream in bytes
#Panic Panic if overflow detected
Trait Implementations§
Source§impl BitWriter<usize> for BitEstream
impl BitWriter<usize> for BitEstream
fn unchecked_write(&mut self, value: usize, nb_bits: u8)
Source§impl Default for BitEstream
impl Default for BitEstream
Source§fn default() -> BitEstream
fn default() -> BitEstream
Returns the “default value” for a type. Read more
Source§impl From<&BitEstream> for Vec<u8>
impl From<&BitEstream> for Vec<u8>
Source§fn from(stream: &BitEstream) -> Self
fn from(stream: &BitEstream) -> Self
Converts to this type from the input type.
Source§impl From<BitEstream> for Vec<u8>
impl From<BitEstream> for Vec<u8>
Source§fn from(stream: BitEstream) -> Self
fn from(stream: BitEstream) -> Self
Converts to this type from the input type.
Source§impl TryFrom<BitEstream> for BitDstream
impl TryFrom<BitEstream> for BitDstream
Source§type Error = BitStreamError
type Error = BitStreamError
The type returned in the event of a conversion error.
Source§fn try_from(stream: BitEstream) -> Result<Self>
fn try_from(stream: BitEstream) -> Result<Self>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for BitEstream
impl RefUnwindSafe for BitEstream
impl Send for BitEstream
impl Sync for BitEstream
impl Unpin for BitEstream
impl UnwindSafe for BitEstream
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