pub struct BlocksBuilder<T>(pub Vec<T>);
Expand description
A convenient wrapper around a vector of blocks. This is used instead of id_arena, since the latter is harder to clone and modify.
Tuple Fields§
§0: Vec<T>
Implementations§
source§impl<T: Default> BlocksBuilder<T>
impl<T: Default> BlocksBuilder<T>
pub fn new() -> Self
pub fn alloc(&mut self, block: T) -> BlockId
sourcepub fn alloc_empty(&mut self) -> BlockId
pub fn alloc_empty(&mut self) -> BlockId
Allocate a new block ID. The block itself should be populated later.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn build(self) -> Option<Blocks<T>>
Trait Implementations§
source§impl<T: Clone> Clone for BlocksBuilder<T>
impl<T: Clone> Clone for BlocksBuilder<T>
source§fn clone(&self) -> BlocksBuilder<T>
fn clone(&self) -> BlocksBuilder<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for BlocksBuilder<T>
impl<T: Debug> Debug for BlocksBuilder<T>
source§impl<T: Default> Default for BlocksBuilder<T>
impl<T: Default> Default for BlocksBuilder<T>
source§fn default() -> BlocksBuilder<T>
fn default() -> BlocksBuilder<T>
Returns the “default value” for a type. Read more
source§impl<T: PartialEq> PartialEq for BlocksBuilder<T>
impl<T: PartialEq> PartialEq for BlocksBuilder<T>
impl<T: Eq> Eq for BlocksBuilder<T>
impl<T> StructuralPartialEq for BlocksBuilder<T>
Auto Trait Implementations§
impl<T> Freeze for BlocksBuilder<T>
impl<T> RefUnwindSafe for BlocksBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for BlocksBuilder<T>where
T: Send,
impl<T> Sync for BlocksBuilder<T>where
T: Sync,
impl<T> Unpin for BlocksBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for BlocksBuilder<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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more