[][src]Struct jlrs::value::WithOutput

pub struct WithOutput<'output, V> { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

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]

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]

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

impl<'output, V> Send for WithOutput<'output, V> where
    V: Send

impl<'output, V> Sync for WithOutput<'output, V> where
    V: Sync

impl<'output, V> Unpin for WithOutput<'output, V> where
    V: Unpin

impl<'output, V> UnwindSafe for WithOutput<'output, V> where
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.