[−][src]Struct jlrs::value::WithOutput
A wrapper that will let you call a Value
as a function and store the result using an
Output
. The function call will not require a slot in the current frame but uses the one
that was allocated for the output. You can create this by calling Value::with_output
.
Because the result of a function call is stored in an already allocated slot, calling a
function returns the CallResult
directly rather than wrapping it in a JlrsResult
except
for the methods that depend on jlrs.jl
.
Implementations
impl<'output, 'frame, 'data> WithOutput<'output, Value<'frame, 'data>>
[src]
pub fn call0<'fr, F>(self, frame: &mut F) -> CallResult<'output, 'static> where
F: Frame<'fr>,
[src]
F: Frame<'fr>,
Call the value as a function that takes zero arguments and use the Output
to extend the
result's lifetime. This takes no space on the GC stack. Returns the result of this
function call if no exception is thrown or the exception if one is.
pub fn call1<'borrow, 'fr, F>(
self,
frame: &mut F,
arg: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
[src]
self,
frame: &mut F,
arg: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
Call the value as a function that takes one argument and use the Output
to extend the
result's lifetime. This takes no space on the GC stack. Returns the result of this
function call if no exception is thrown or the exception if one is.
pub fn call2<'borrow, 'fr, F>(
self,
frame: &mut F,
arg0: Value<'_, 'borrow>,
arg1: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
[src]
self,
frame: &mut F,
arg0: Value<'_, 'borrow>,
arg1: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
Call the value as a function that takes two arguments and use the Output
to extend the
result's lifetime. This takes no space on the GC stack. Returns the result of this
function call if no exception is thrown or the exception if one is.
pub fn call3<'borrow, 'fr, F>(
self,
frame: &mut F,
arg0: Value<'_, 'borrow>,
arg1: Value<'_, 'borrow>,
arg2: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
[src]
self,
frame: &mut F,
arg0: Value<'_, 'borrow>,
arg1: Value<'_, 'borrow>,
arg2: Value<'_, 'borrow>
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
F: Frame<'fr>,
Call the value as a function that takes three arguments and use the Output
to extend
the result's lifetime. This takes no space on the GC stack. Returns the result of this
function call if no exception is thrown or the exception if one is.
pub fn call<'value, 'borrow, 'fr, V, F>(
self,
frame: &mut F,
args: V
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
V: AsMut<[Value<'value, 'borrow>]>,
F: Frame<'fr>,
[src]
self,
frame: &mut F,
args: V
) -> CallResult<'output, 'borrow> where
'borrow: 'output,
V: AsMut<[Value<'value, 'borrow>]>,
F: Frame<'fr>,
Call the value as a function that takes several arguments and use the Output
to extend
the result's lifetime. This takes no space on the GC stack. Returns the result of this
function call if no exception is thrown or the exception if one is.
pub fn call_values<'fr, F>(
self,
frame: &mut F,
args: Values
) -> CallResult<'output, 'static> where
F: Frame<'fr>,
[src]
self,
frame: &mut F,
args: Values
) -> CallResult<'output, 'static> where
F: Frame<'fr>,
Call the value as a function that takes several arguments in a single Values
and use
the Output
to extend the result's lifetime. This takes no space on the GC stack. Returns
the result of this function call if no exception is thrown or the exception if one is.
pub fn tracing_call<'fr, F>(
self,
frame: &mut F
) -> JlrsResult<CallResult<'output, 'data>> where
F: Frame<'fr>,
[src]
self,
frame: &mut F
) -> JlrsResult<CallResult<'output, 'data>> where
F: Frame<'fr>,
Returns an anonymous function that wraps the value in a try-catch block. Calling this
anonymous function with some arguments will call the value as a function with those
arguments and return its result, or catch the exception, print the stackstrace, and
rethrow that exception. The output is used to protect the result. You must include
jlrs.jl
to use this function.
pub fn attach_stacktrace<'fr, F>(
self,
frame: &mut F
) -> JlrsResult<CallResult<'output, 'data>> where
F: Frame<'fr>,
[src]
self,
frame: &mut F
) -> JlrsResult<CallResult<'output, 'data>> where
F: Frame<'fr>,
Returns an anonymous function that wraps the value in a try-catch block. Calling this
anonymous function with some arguments will call the value as a function with those
arguments and return its result, or catch the exception and throw a new one with two
fields, exc
and stacktrace
, containing the original exception and the stacktrace
respectively. The output is used to protect the result. You must include jlrs.jl
to use
this function.
Auto Trait Implementations
impl<'output, V> RefUnwindSafe for WithOutput<'output, V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<'output, V> Send for WithOutput<'output, V> where
V: Send,
V: Send,
impl<'output, V> Sync for WithOutput<'output, V> where
V: Sync,
V: Sync,
impl<'output, V> Unpin for WithOutput<'output, V> where
V: Unpin,
V: Unpin,
impl<'output, V> UnwindSafe for WithOutput<'output, V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,