pub struct AsyncGcFrame<'scope> { /* private fields */ }
Expand description
A frame associated with an async scope.
The only difference between a GcFrame
and an AsyncGcFrame
is that the latter
allows calling several async methods, most importantly those of CallAsync
. An
AsyncGcFrame
can be (mutably) dereferenced as a GcFrame
, so all methods of GcFrame
are available to AsyncGcFrame
.
Implementations§
source§impl<'scope> AsyncGcFrame<'scope>
impl<'scope> AsyncGcFrame<'scope>
sourcepub async fn async_scope<'nested, T, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<T>
pub async fn async_scope<'nested, T, F, G>( &'nested mut self, func: F ) -> JlrsResult<T>
An async version of GcFrame::scope
.
The closure func
must return an async block. Note that the returned value is
required to live at least as long the current frame.
sourcepub async unsafe fn relaxed_async_scope<'nested, T, F, G>(
&'nested mut self,
func: F
) -> JlrsResult<T>
pub async unsafe fn relaxed_async_scope<'nested, T, F, G>( &'nested mut self, func: F ) -> JlrsResult<T>
AsyncGcFrame::async_scope
with less strict lifeitme bounds on the return value.
Safety: because this method only requires that the returned data lives at least as
long as the borrow of self
, it’s possible to return data rooted in that scope
which you must not do.
Methods from Deref<Target = GcFrame<'scope>>§
sourcepub fn borrow<'borrow>(
&'borrow mut self
) -> BorrowedFrame<'borrow, 'scope, Self>
pub fn borrow<'borrow>( &'borrow mut self ) -> BorrowedFrame<'borrow, 'scope, Self>
Borrow the current frame.
sourcepub fn extended_target<'target, 'borrow, T>(
&'borrow mut self,
target: T
) -> ExtendedTarget<'target, 'scope, 'borrow, T>where
T: Target<'target>,
pub fn extended_target<'target, 'borrow, T>(
&'borrow mut self,
target: T
) -> ExtendedTarget<'target, 'scope, 'borrow, T>where
T: Target<'target>,
Borrow this frame as an ExtendedTarget
with the provided target
.
sourcepub fn as_extended_target<'borrow>(
&'borrow mut self
) -> ExtendedTarget<'scope, 'scope, 'borrow, Output<'scope>>
pub fn as_extended_target<'borrow>( &'borrow mut self ) -> ExtendedTarget<'scope, 'scope, 'borrow, Output<'scope>>
Borrow this frame as an ExtendedTarget
with an Output
that targets this frame.
sourcepub fn stack_size(&self) -> usize
pub fn stack_size(&self) -> usize
Returns the number of values rooted in this frame.
sourcepub fn reusable_slot(&self) -> ReusableSlot<'scope>
pub fn reusable_slot(&self) -> ReusableSlot<'scope>
Returns a ReusableSlot
that targets the current frame.
sourcepub fn scope<T, F>(&mut self, func: F) -> JlrsResult<T>
pub fn scope<T, F>(&mut self, func: F) -> JlrsResult<T>
Create a temporary scope and call func
with that scope’s GcFrame
.
Example:
julia
.scope(|mut frame| {
let output = frame.output();
let _sum = frame.scope(|mut frame| {
let i = Value::new(&mut frame, 1u64);
let j = Value::new(&mut frame, 2u64);
unsafe {
Module::base(&frame)
.function(&mut frame, "+")?
.call2(output, i, j)
.into_jlrs_result()
}
})?;
Ok(())
})
.unwrap();
Trait Implementations§
source§impl<'scope> Deref for AsyncGcFrame<'scope>
impl<'scope> Deref for AsyncGcFrame<'scope>
source§impl<'scope> DerefMut for AsyncGcFrame<'scope>
impl<'scope> DerefMut for AsyncGcFrame<'scope>
source§impl<'target> Target<'target> for &mut AsyncGcFrame<'target>
impl<'target> Target<'target> for &mut AsyncGcFrame<'target>
source§fn local_scope<T, F, const M: usize>(&self, func: F) -> JlrsResult<T>
fn local_scope<T, F, const M: usize>(&self, func: F) -> JlrsResult<T>
func
. Read moresource§fn with_local_scope<T, F, const M: usize>(self, func: F) -> JlrsResult<T>
fn with_local_scope<T, F, const M: usize>(self, func: F) -> JlrsResult<T>
func
. Read moresource§fn into_extended_target<'borrow, 'current>(
self,
frame: &'borrow mut GcFrame<'current>
) -> ExtendedTarget<'target, 'current, 'borrow, Self>
fn into_extended_target<'borrow, 'current>( self, frame: &'borrow mut GcFrame<'current> ) -> ExtendedTarget<'target, 'current, 'borrow, Self>
self
into an ExtendedTarget
.source§fn into_extended_async_target<'borrow, 'current>(
self,
frame: &'borrow mut AsyncGcFrame<'current>
) -> ExtendedAsyncTarget<'target, 'current, 'borrow, Self>
fn into_extended_async_target<'borrow, 'current>( self, frame: &'borrow mut AsyncGcFrame<'current> ) -> ExtendedAsyncTarget<'target, 'current, 'borrow, Self>
self
into an ExtendedAsyncTarget
.source§impl<'target> Target<'target> for AsyncGcFrame<'target>
impl<'target> Target<'target> for AsyncGcFrame<'target>
source§fn local_scope<T, F, const M: usize>(&self, func: F) -> JlrsResult<T>
fn local_scope<T, F, const M: usize>(&self, func: F) -> JlrsResult<T>
func
. Read moresource§fn with_local_scope<T, F, const M: usize>(self, func: F) -> JlrsResult<T>
fn with_local_scope<T, F, const M: usize>(self, func: F) -> JlrsResult<T>
func
. Read moresource§fn into_extended_target<'borrow, 'current>(
self,
frame: &'borrow mut GcFrame<'current>
) -> ExtendedTarget<'target, 'current, 'borrow, Self>
fn into_extended_target<'borrow, 'current>( self, frame: &'borrow mut GcFrame<'current> ) -> ExtendedTarget<'target, 'current, 'borrow, Self>
self
into an ExtendedTarget
.source§fn into_extended_async_target<'borrow, 'current>(
self,
frame: &'borrow mut AsyncGcFrame<'current>
) -> ExtendedAsyncTarget<'target, 'current, 'borrow, Self>
fn into_extended_async_target<'borrow, 'current>( self, frame: &'borrow mut AsyncGcFrame<'current> ) -> ExtendedAsyncTarget<'target, 'current, 'borrow, Self>
self
into an ExtendedAsyncTarget
.source§impl<'target> TargetType<'target> for &mut AsyncGcFrame<'target>
impl<'target> TargetType<'target> for &mut AsyncGcFrame<'target>
source§impl<'target> TargetType<'target> for AsyncGcFrame<'target>
impl<'target> TargetType<'target> for AsyncGcFrame<'target>
Auto Trait Implementations§
impl<'scope> !RefUnwindSafe for AsyncGcFrame<'scope>
impl<'scope> Send for AsyncGcFrame<'scope>
impl<'scope> Sync for AsyncGcFrame<'scope>
impl<'scope> Unpin for AsyncGcFrame<'scope>
impl<'scope> !UnwindSafe for AsyncGcFrame<'scope>
Blanket Implementations§
source§impl<T> AttachParachute for T
impl<T> AttachParachute for T
source§fn attach_parachute<'scope, T: Target<'scope>>(
self,
target: T
) -> WithParachute<'scope, Self>
fn attach_parachute<'scope, T: Target<'scope>>( self, target: T ) -> WithParachute<'scope, Self>
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
source§impl<'frame, T> Gc for Twhere
T: Target<'frame>,
impl<'frame, T> Gc for Twhere
T: Target<'frame>,
source§fn enable_gc_logging(&self, on: bool)
fn enable_gc_logging(&self, on: bool)
source§fn gc_is_enabled(&self) -> bool
fn gc_is_enabled(&self) -> bool
true
if the GC is enabled.source§fn gc_collect(&self, mode: GcCollection)
fn gc_collect(&self, mode: GcCollection)
source§fn gc_safepoint(&self)
fn gc_safepoint(&self)
source§unsafe fn gc_safe_enter() -> i8
unsafe fn gc_safe_enter() -> i8
source§unsafe fn gc_safe_leave(state: i8)
unsafe fn gc_safe_leave(state: i8)
source§unsafe fn gc_unsafe_enter() -> i8
unsafe fn gc_unsafe_enter() -> i8
source§unsafe fn gc_unsafe_leave(state: i8)
unsafe fn gc_unsafe_leave(state: i8)
source§fn gc_set_max_memory(max_mem: u64)
fn gc_set_max_memory(max_mem: u64)
§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>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.