Struct jlrs::extensions::multitask::async_frame::AsyncGcFrame [−][src]
pub struct AsyncGcFrame<'frame> { /* fields omitted */ }
Expand description
A frame that can be used to root values and dispatch Julia function calls to another thread
with CallAsync::call_async
. An AsyncGcFrame
is available by implementing the AsyncTask
trait, this struct provides create a nested async scope.
Roots are stored in slots, each slot can contain one root. Frames created with slots will preallocate that number of slots. Frames created without slots will dynamically create new slots as needed. A frame is able to create at least 16 slots. If there is sufficient capacity available, a new frame will use this remaining capacity. If the capacity is insufficient, more stack space is allocated.
Implementations
pub async fn async_value_scope<'nested, 'data, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<Value<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputValue<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_value_scope<'nested, 'data, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<Value<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputValue<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
An async version of Scope::value_scope
. Rather than a closure, it takes an async
closure that provides a new AsyncGcFrame
.
pub async fn async_value_scope_with_slots<'nested, 'data, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<Value<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputValue<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_value_scope_with_slots<'nested, 'data, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<Value<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputValue<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
An async version of Scope::value_scope_with_slots
. Rather than a closure, it takes an
async closure that provides a new AsyncGcFrame
.
pub async fn async_result_scope<'nested, 'data, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<JuliaResult<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputResult<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_result_scope<'nested, 'data, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<JuliaResult<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputResult<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
An async version of Scope::result_scope
. Rather than a closure, it takes an async
closure that provides a new AsyncGcFrame
.
pub async fn async_result_scope_with_slots<'nested, 'data, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<JuliaResult<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputResult<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_result_scope_with_slots<'nested, 'data, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<JuliaResult<'frame, 'data>> where
G: Future<Output = JlrsResult<OutputResult<'frame, 'data, 'nested>>>,
F: FnOnce(Output<'frame>, &'nested mut AsyncGcFrame<'nested>) -> G,
An async version of Scope::result_scope_with_slots
. Rather than a closure, it takes an
async closure that provides a new AsyncGcFrame
.
pub async fn async_scope<'nested, T, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<T> where
T: 'frame,
G: Future<Output = JlrsResult<T>>,
F: FnOnce(&'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_scope<'nested, T, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<T> where
T: 'frame,
G: Future<Output = JlrsResult<T>>,
F: FnOnce(&'nested mut AsyncGcFrame<'nested>) -> G,
An async version of ScopeExt::scope
. Rather than a closure, it takes an async closure
that provides a new AsyncGcFrame
.
pub async fn async_scope_with_slots<'nested, T, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<T> where
T: 'frame,
G: Future<Output = JlrsResult<T>>,
F: FnOnce(&'nested mut AsyncGcFrame<'nested>) -> G,
pub async fn async_scope_with_slots<'nested, T, F, G>(
&'nested mut self,
capacity: usize,
func: F
) -> JlrsResult<T> where
T: 'frame,
G: Future<Output = JlrsResult<T>>,
F: FnOnce(&'nested mut AsyncGcFrame<'nested>) -> G,
An async version of ScopeExt::scope_with_slots
. Rather than a closure, it takes an
async closure that provides a new AsyncGcFrame
.
Returns the number of slots that are currently allocated to this frame.
Try to allocate additional
slots in the current frame. Returns true
on success, or
false
if self.n_slots() + additional > self.capacity()
.
Trait Implementations
Reserve additional
slots in the current frame. Returns true
on success, or false
if
self.n_slots() + additional > self.capacity()
. Read more
Returns the number of slots that are currently allocated to this frame.
Auto Trait Implementations
impl<'frame> !RefUnwindSafe for AsyncGcFrame<'frame>
impl<'frame> !Send for AsyncGcFrame<'frame>
impl<'frame> !Sync for AsyncGcFrame<'frame>
impl<'frame> Unpin for AsyncGcFrame<'frame>
impl<'frame> !UnwindSafe for AsyncGcFrame<'frame>
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns true
if the GC is enabled.
Force a collection.
Insert a safepoint, a point where the garbage collector may run.