pub struct Arena {
data: RefCell<Vec<Pin<Box<dyn Any>>>>,
}Expand description
A really dumb arena implementation intended not for efficiency but rather to prolong lifetimes.
Fields§
§data: RefCell<Vec<Pin<Box<dyn Any>>>>List of values inserted into the arena. They cannot be moved out from the box or dropped until the arena is dropped.
The use of Box is needed to ensure the address of the value is stable.
The Pin and dyn Any parts are just for fun and/or convenience.
The pin is expressing the “don’t move” constraint but is neither necessary
nor sufficient for soundness (it doesn’t prevent drops),
and the dyn Any is just to capture the destructor but we don’t do
any downcasting.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Arena
impl !RefUnwindSafe for Arena
impl !Send for Arena
impl !Sync for Arena
impl Unpin for Arena
impl UnsafeUnpin for Arena
impl !UnwindSafe for Arena
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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