pub struct BumpBox<'a, T> { /* private fields */ }Expand description
An arena-allocated box that retains a reference to its Bump allocator, enabling Clone support.
Unlike bumpalo::boxed::Box, which only stores a mutable reference to the allocated value (and thus cannot
implement Clone without the allocator), BumpBox stores both the allocator reference and the value pointer.
This allows it to allocate a new copy during Clone::clone.
This type is intended for recursive AST nodes (e.g. color-mix() containing nested <color> values) where
indirection is required to break the cycle, but the allocation should still live in the parsing arena.
Implementations§
Trait Implementations§
Source§impl<M: NodeMetadata, T: NodeWithMetadata<M>> NodeWithMetadata<M> for BumpBox<'_, T>
impl<M: NodeMetadata, T: NodeWithMetadata<M>> NodeWithMetadata<M> for BumpBox<'_, T>
Source§fn self_metadata(&self) -> M
fn self_metadata(&self) -> M
Returns the metadata contributed by this node itself, not including children.
Most nodes don’t contribute metadata, so can simply return
M::default().
Nodes like StyleRule or AtRules should return their own node kind flags here.Source§impl<T: Ord> Ord for BumpBox<'_, T>
impl<T: Ord> Ord for BumpBox<'_, T>
Source§impl<T: PartialOrd> PartialOrd for BumpBox<'_, T>
impl<T: PartialOrd> PartialOrd for BumpBox<'_, T>
Source§impl<T: SemanticEq> SemanticEq for BumpBox<'_, T>
impl<T: SemanticEq> SemanticEq for BumpBox<'_, T>
Source§fn semantic_eq(&self, other: &Self) -> bool
fn semantic_eq(&self, other: &Self) -> bool
Returns
true if self and other are semantically equal.Source§impl<T: ToCursors> ToCursors for BumpBox<'_, T>
impl<T: ToCursors> ToCursors for BumpBox<'_, T>
fn to_cursors(&self, s: &mut impl CursorSink)
impl<T: Eq> Eq for BumpBox<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for BumpBox<'a, T>
impl<'a, T> !RefUnwindSafe for BumpBox<'a, T>
impl<'a, T> !Send for BumpBox<'a, T>
impl<'a, T> !Sync for BumpBox<'a, T>
impl<'a, T> Unpin for BumpBox<'a, T>
impl<'a, T> UnsafeUnpin for BumpBox<'a, T>
impl<'a, T> !UnwindSafe for BumpBox<'a, T>
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