pub struct BooleanBufferBuilder { /* private fields */ }
Expand description

Builder for BooleanBuffer

Implementations§

source§

impl BooleanBufferBuilder

source

pub fn new(capacity: usize) -> BooleanBufferBuilder

Creates a new BooleanBufferBuilder

source

pub fn new_from_buffer( buffer: MutableBuffer, len: usize ) -> BooleanBufferBuilder

Creates a new BooleanBufferBuilder from MutableBuffer of len

source

pub fn len(&self) -> usize

Returns the length of the buffer

source

pub fn set_bit(&mut self, index: usize, v: bool)

Sets a bit in the buffer at index

source

pub fn get_bit(&self, index: usize) -> bool

Gets a bit in the buffer at index

source

pub fn is_empty(&self) -> bool

Returns true if empty

source

pub fn capacity(&self) -> usize

Returns the capacity of the buffer

source

pub fn advance(&mut self, additional: usize)

Advances the buffer by additional bits

source

pub fn truncate(&mut self, len: usize)

Truncates the builder to the given length

If len is greater than the buffer’s current length, this has no effect

source

pub fn reserve(&mut self, additional: usize)

Reserve space to at least additional new bits. Capacity will be >= self.len() + additional. New bytes are uninitialized and reading them is undefined behavior.

source

pub fn resize(&mut self, len: usize)

Resizes the buffer, either truncating its contents (with no change in capacity), or growing it (potentially reallocating it) and writing false in the newly available bits.

source

pub fn append(&mut self, v: bool)

Appends a boolean v into the buffer

source

pub fn append_n(&mut self, additional: usize, v: bool)

Appends n additional bits of value v into the buffer

source

pub fn append_slice(&mut self, slice: &[bool])

Appends a slice of booleans into the buffer

source

pub fn append_packed_range(&mut self, range: Range<usize>, to_set: &[u8])

Append range bits from to_set

to_set is a slice of bits packed LSB-first into [u8]

§Panics

Panics if to_set does not contain ceil(range.end / 8) bytes

source

pub fn append_buffer(&mut self, buffer: &BooleanBuffer)

source

pub fn as_slice(&self) -> &[u8]

Returns the packed bits

source

pub fn as_slice_mut(&mut self) -> &mut [u8]

Returns the packed bits

source

pub fn finish(&mut self) -> BooleanBuffer

Creates a BooleanBuffer

source

pub fn finish_cloned(&self) -> BooleanBuffer

Builds the BooleanBuffer without resetting the builder.

Trait Implementations§

source§

impl Debug for BooleanBufferBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<BooleanBufferBuilder> for BooleanBuffer

source§

fn from(builder: BooleanBufferBuilder) -> BooleanBuffer

Converts to this type from the input type.
source§

impl From<BooleanBufferBuilder> for Buffer

source§

fn from(builder: BooleanBufferBuilder) -> Buffer

Converts to this type from the input type.

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>,

§

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>,

§

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.
source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

impl<T> Ungil for T
where T: Send,