pub struct NodeBlock { /* private fields */ }Expand description
A block of nodes in contiguous memory, used for arena allocation.
Each block holds up to NODE_BLOCK_CAPACITY nodes allocated in
a Vec<ArtNode>. New nodes are appended; existing nodes are never
individually freed (the entire block is freed on clear).
Port of C++ NodeBlock from art_index.h (lines 148–163).
Implementations§
Source§impl NodeBlock
impl NodeBlock
pub fn new() -> Self
Sourcepub fn allocate(&mut self, node: ArtNode) -> usize
pub fn allocate(&mut self, node: ArtNode) -> usize
Allocate a new node in this block. Returns the index within the block.
Sourcepub fn get_mut(&mut self, idx: usize) -> Option<&mut ArtNode>
pub fn get_mut(&mut self, idx: usize) -> Option<&mut ArtNode>
Get a mutable reference to a node by index.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeBlock
impl RefUnwindSafe for NodeBlock
impl Send for NodeBlock
impl Sync for NodeBlock
impl Unpin for NodeBlock
impl UnsafeUnpin for NodeBlock
impl UnwindSafe for NodeBlock
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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