Struct BitBuf

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

Implementations§

Source§

impl BitBuf

Source

pub fn with_len(len: usize) -> BitBuf

Creates a new BitBuf, initializing a new Vec. for the underlying buffer.

Source

pub fn to_vec(self) -> Vec<u8>

Consumes the BitBuf, returning the underlying Vec.

Source

pub fn bit_size(&self) -> usize

Returns a slice into the underlying Vec buffer. The current bit size of the Vec.

Source

pub fn bit_pos(&self) -> usize

The current position of the cursor. The BitBuf does not insert, and will overwrite any data currently at the cursor position during writing.

Source

pub fn can_write_bits(&self, bit_size: usize) -> bool

Source

pub fn can_read_bits(&self, bit_size: usize) -> bool

Source

pub fn write_bool(&mut self, value: bool)

Source

pub fn read_bool(&mut self) -> bool

Source

pub fn write_i8(&mut self, value: i8)

Source

pub fn read_i8(&mut self) -> i8

Source

pub fn write_u8(&mut self, value: u8)

Source

pub fn read_u8(&mut self) -> u8

Source

pub fn write_u8_part(&mut self, value: u8, bits: u8)

Source

pub fn read_u8_part(&mut self, bits: u8) -> u8

Source

pub fn write_u16(&mut self, value: u16)

Source

pub fn read_u16(&mut self) -> u16

Source

pub fn write_u16_part(&mut self, value: u16, bits: u8)

Source

pub fn read_u16_part(&mut self, bits: u8) -> u16

Source

pub fn write_i16(&mut self, value: i16)

Source

pub fn read_i16(&mut self) -> i16

Source

pub fn write_u32(&mut self, value: u32)

Source

pub fn read_u32(&mut self) -> u32

Source

pub fn write_u32_part(&mut self, value: u32, bits: u8)

Source

pub fn read_u32_part(&mut self, bits: u8) -> u32

Source

pub fn read_i32(&mut self) -> i32

Source

pub fn write_i32(&mut self, value: i32)

Source

pub fn write_u64(&mut self, value: u64)

Source

pub fn read_u64(&mut self) -> u64

Source

pub fn write_u64_part(&mut self, value: u64, bits: u8)

Source

pub fn read_u64_part(&mut self, bits: u8) -> u64

Source

pub fn write_i64(&mut self, value: i64)

Source

pub fn read_i64(&mut self) -> i64

Source

pub fn write_f32(&mut self, value: f32)

Source

pub fn read_f32(&mut self) -> f32

Source

pub fn write_f64(&mut self, value: f64)

Source

pub fn read_f64(&mut self) -> f64

Source

pub fn write_u8_slice(&mut self, value: &[u8])

Source

pub fn read_vec_u8(&mut self, length: usize) -> Vec<u8>

Source

pub fn write_string(&mut self, value: &str)

Source

pub fn read_string(&mut self) -> String

Trait Implementations§

Source§

impl Clone for BitBuf

Source§

fn clone(&self) -> BitBuf

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl Freeze for BitBuf

§

impl RefUnwindSafe for BitBuf

§

impl Send for BitBuf

§

impl Sync for BitBuf

§

impl Unpin for BitBuf

§

impl UnwindSafe for BitBuf

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.