pub trait Frame<'frame>: FramePriv<'frame> {
fn output(&mut self) -> JlrsResult<Output<'frame>>;
fn reusable_slot(&mut self) -> JlrsResult<ReusableSlot<'frame>>;
fn n_roots(&self) -> usize;
fn capacity(&self) -> usize;
fn as_scope(&mut self) -> &mut Self { ... }
fn scope<T, F>(&mut self, func: F) -> JlrsResult<T>
where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
{ ... }
fn scope_with_capacity<T, F>(
&mut self,
capacity: usize,
func: F
) -> JlrsResult<T>
where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
{ ... }
}
Expand description
Functionality shared by the different frame types.
Required Methods
fn output(&mut self) -> JlrsResult<Output<'frame>>
fn output(&mut self) -> JlrsResult<Output<'frame>>
Reserve a new output in the current frame.
Returns an error if the frame is full.
fn reusable_slot(&mut self) -> JlrsResult<ReusableSlot<'frame>>
fn reusable_slot(&mut self) -> JlrsResult<ReusableSlot<'frame>>
Reserve a new reusable slot in the current frame.
Returns an error if the frame is full.
Provided Methods
Convert the frame to a scope.
This method takes a mutable reference to a frame and returns it, it can be used as an
alternative to borrowing a frame with when a Scope
or PartialScope
is needed.
fn scope<T, F>(&mut self, func: F) -> JlrsResult<T> where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
fn scope<T, F>(&mut self, func: F) -> JlrsResult<T> where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
Create a new scope and call func with that scope’s frame.
The frame can store at least 16 roots.
fn scope_with_capacity<T, F>(&mut self, capacity: usize, func: F) -> JlrsResult<T> where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
fn scope_with_capacity<T, F>(&mut self, capacity: usize, func: F) -> JlrsResult<T> where
for<'inner> F: FnOnce(GcFrame<'inner, Self::Mode>) -> JlrsResult<T>,
Create a new scope and call func with that scope’s frame.
The frame can store at least capacity
roots.