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>
impl<const N: usize, T> ConstArrayBuilder<N, T>
sourcepub const fn new_empty(full_array: [T; N], cursor: usize) -> Self
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
.
sourcepub const fn from_manual_slice(
full_array: [T; N],
start: usize,
limit: usize,
) -> Self
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)
.
sourcepub const fn as_const_slice(&self) -> ConstSlice<'_, T>
pub const fn as_const_slice(&self) -> ConstSlice<'_, T>
Returns the initialized elements as a ConstSlice
.
source§impl<const N: usize, T: Copy> ConstArrayBuilder<N, T>
impl<const N: usize, T: Copy> ConstArrayBuilder<N, T>
sourcepub const fn const_take_or_panic(self) -> [T; N]
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.
sourcepub const fn const_push_front_or_panic(self, value: T) -> Self
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.
sourcepub const fn const_extend_front_or_panic(self, other: ConstSlice<'_, T>) -> Self
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>
impl<const N: usize> ConstArrayBuilder<N, u8>
sourcepub const fn const_bitor_assign(self, index: usize, bits: u8) -> Self
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>
impl<const N: usize, T: Copy> ConstArrayBuilder<N, T>
sourcepub fn swap_or_panic(self, i: usize, j: usize) -> Self
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>
impl<const K: usize> ConstArrayBuilder<K, BranchMeta>
sourcepub const fn map_to_ascii_bytes(&self) -> ConstArrayBuilder<K, u8>
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>
impl<const N: usize, T: Clone> Clone for ConstArrayBuilder<N, T>
source§fn clone(&self) -> ConstArrayBuilder<N, T>
fn clone(&self) -> ConstArrayBuilder<N, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl<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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)