Struct zerotrie::builder::konst::store::ConstArrayBuilder

source ·
pub(crate) struct ConstArrayBuilder<const N: usize, T> {
    full_array: [T; N],
    start: usize,
    limit: usize,
}
Expand description

A const-friendly mutable data structure backed by an array.

Fields§

§full_array: [T; N]§start: usize§limit: usize

Implementations§

source§

impl<const N: usize, T> ConstArrayBuilder<N, T>

source

pub const fn new_empty(full_array: [T; N], cursor: usize) -> Self

Creates a new, empty builder of the given size. cursor indicates where in the array new elements will be inserted first. Since we use a lot of prepend operations, it is common to set cursor to N.

source

pub const fn from_manual_slice( full_array: [T; N], start: usize, limit: usize, ) -> Self

Creates a new builder with some initial content in [start, limit).

source

pub const fn len(&self) -> usize

Returns the number of initialized elements in the builder.

source

pub const fn is_empty(&self) -> bool

Whether there are no initialized elements in the builder.

source

pub const fn as_const_slice(&self) -> ConstSlice<'_, T>

Returns the initialized elements as a ConstSlice.

source

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

Non-const function that returns a slice of the initialized elements.

source§

impl<const N: usize, T: Copy> ConstArrayBuilder<N, T>

source

pub const fn const_take_or_panic(self) -> [T; N]

Takes a fully initialized builder as an array. Panics if the builder is not fully initialized.

source

pub const fn const_push_front_or_panic(self, value: T) -> Self

Prepends an element to the front of the builder, panicking if there is no room.

source

pub const fn const_extend_front_or_panic(self, other: ConstSlice<'_, T>) -> Self

Prepends multiple elements to the front of the builder, panicking if there is no room.

source§

impl<const N: usize> ConstArrayBuilder<N, u8>

source

pub const fn const_bitor_assign(self, index: usize, bits: u8) -> Self

Specialized function that performs self[index] |= bits

source§

impl<const N: usize, T: Copy> ConstArrayBuilder<N, T>

source

pub fn swap_or_panic(self, i: usize, j: usize) -> Self

Swaps the elements at positions i and j.

source§

impl<const K: usize> ConstArrayBuilder<K, BranchMeta>

source

pub const fn map_to_ascii_bytes(&self) -> ConstArrayBuilder<K, u8>

Converts this builder-array of BranchMeta to one of the ascii fields.

Trait Implementations§

source§

impl<const N: usize, T: Clone> Clone for ConstArrayBuilder<N, T>

source§

fn clone(&self) -> ConstArrayBuilder<N, T>

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

impl<const N: usize, T: Debug> Debug for ConstArrayBuilder<N, T>

source§

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

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

impl<const N: usize, T: Default> Default for ConstArrayBuilder<N, T>

source§

fn default() -> Self

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

impl<const N: usize, T: Copy> Copy for ConstArrayBuilder<N, T>

Auto Trait Implementations§

§

impl<const N: usize, T> Freeze for ConstArrayBuilder<N, T>
where T: Freeze,

§

impl<const N: usize, T> RefUnwindSafe for ConstArrayBuilder<N, T>
where T: RefUnwindSafe,

§

impl<const N: usize, T> Send for ConstArrayBuilder<N, T>
where T: Send,

§

impl<const N: usize, T> Sync for ConstArrayBuilder<N, T>
where T: Sync,

§

impl<const N: usize, T> Unpin for ConstArrayBuilder<N, T>
where T: Unpin,

§

impl<const N: usize, T> UnwindSafe for ConstArrayBuilder<N, T>
where T: UnwindSafe,

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

§

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

§

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> ErasedDestructor for T
where T: 'static,