Struct BitEstream

Source
pub struct BitEstream { /* private fields */ }

Implementations§

Source§

impl BitEstream

Source

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

Source

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 !

Source

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

Source

pub fn flush_bits(&mut self)

Push nb_bytes into stream and clean pushed from container

§Panic

If stream overflow

Source

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

Source§

fn unchecked_write(&mut self, value: usize, nb_bits: u8)

Source§

impl Default for BitEstream

Source§

fn default() -> BitEstream

Returns the “default value” for a type. Read more
Source§

impl From<&BitEstream> for Vec<u8>

Source§

fn from(stream: &BitEstream) -> Self

Converts to this type from the input type.
Source§

impl From<BitEstream> for Vec<u8>

Source§

fn from(stream: BitEstream) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<BitEstream> for BitDstream

Source§

type Error = BitStreamError

The type returned in the event of a conversion error.
Source§

fn try_from(stream: BitEstream) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.