pub trait TakeIn<'a>: Dummy<'a> {
// Provided methods
fn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self { ... }
fn take_in_box(
&mut self,
allocator_accessor: &impl GetAllocator<'a>,
) -> Box<'a, Self> { ... }
}Expand description
A trait to replace an existing AST node with a dummy.
Provided Methods§
Sourcefn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self
fn take_in(&mut self, allocator_accessor: &impl GetAllocator<'a>) -> Self
Replace node with a dummy, and return the original.
If you’re taking the node out to build a new node from it and store the result back
in the same slot, prefer replace_with. take_in writes a dummy into the arena,
which takes up space there forever. replace_with avoids that (no dummy), so is faster
and uses less memory.
Sourcefn take_in_box(
&mut self,
allocator_accessor: &impl GetAllocator<'a>,
) -> Box<'a, Self>
fn take_in_box( &mut self, allocator_accessor: &impl GetAllocator<'a>, ) -> Box<'a, Self>
Replace node with a dummy, allocate the original node into the arena,
and return it as a Box<Self>.
If you’re taking the node out to build a new node from it and store the result back
in the same slot, prefer replace_with. take_in writes a dummy into the arena,
which takes up space there forever. replace_with avoids that (no dummy), so is faster
and uses less memory.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".