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: usizeImplementations§
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_build_or_panic(self) -> [T; N]
pub const fn const_build_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(&mut self, value: T)
pub const fn const_push_front_or_panic(&mut self, value: T)
Prepends an element to the front of the builder, panicking if there is no room.
Sourcepub const fn const_extend_front_or_panic(&mut self, other: ConstSlice<'_, T>)
pub const fn const_extend_front_or_panic(&mut self, other: ConstSlice<'_, T>)
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(crate) const fn const_bitor_assign_or_panic(
&mut self,
index: usize,
bits: u8,
)
pub(crate) const fn const_bitor_assign_or_panic( &mut self, index: usize, bits: u8, )
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(&mut self, i: usize, j: usize)
pub fn swap_or_panic(&mut self, i: usize, j: usize)
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more