[][src]Enum lucet_runtime::RunResult

pub enum RunResult {
    Returned(UntypedRetVal),
    Yielded(YieldedVal),
}

The result of running or resuming an Instance.

Variants

Returned(UntypedRetVal)

An instance returned with a value.

The actual type of the contained value depends on the return type of the guest function that was called. For guest functions with no return value, it is undefined behavior to do anything with this value.

Yielded(YieldedVal)

An instance yielded, potentially with a value.

This arises when a hostcall invokes one of the Vmctx::yield_*() family of methods. Depending on which variant is used, the YieldedVal may contain a value passed from the guest context to the host.

An instance that has yielded may only be resumed (with or without a value to returned to the guest), reset, or dropped. Attempting to run an instance from a new entrypoint after it has yielded but without first resetting will result in an error.

Methods

impl RunResult[src]

pub fn returned(self) -> Result<UntypedRetVal, Error>[src]

Try to get a return value from a run result, returning Error::InstanceNotReturned if the instance instead yielded.

pub fn returned_ref(&self) -> Result<&UntypedRetVal, Error>[src]

Try to get a reference to a return value from a run result, returning Error::InstanceNotReturned if the instance instead yielded.

pub fn is_returned(&self) -> bool[src]

Returns true if the instance returned a value.

pub fn expect_returned(self, msg: &str) -> UntypedRetVal[src]

Unwraps a run result into a return value.

Panics

Panics if the instance instead yielded, with a panic message including the passed message.

pub fn unwrap_returned(self) -> UntypedRetVal[src]

Unwraps a run result into a returned value.

Panics

Panics if the instance instead yielded.

pub fn yielded(self) -> Result<YieldedVal, Error>[src]

Try to get a yielded value from a run result, returning Error::InstanceNotYielded if the instance instead returned.

pub fn yielded_ref(&self) -> Result<&YieldedVal, Error>[src]

Try to get a reference to a yielded value from a run result, returning Error::InstanceNotYielded if the instance instead returned.

pub fn is_yielded(&self) -> bool[src]

Returns true if the instance yielded.

pub fn expect_yielded(self, msg: &str) -> YieldedVal[src]

Unwraps a run result into a yielded value.

Panics

Panics if the instance instead returned, with a panic message including the passed message.

pub fn unwrap_yielded(self) -> YieldedVal[src]

Unwraps a run result into a yielded value.

Panics

Panics if the instance instead returned.

Trait Implementations

impl Debug for RunResult[src]

Auto Trait Implementations

impl !RefUnwindSafe for RunResult

impl !Send for RunResult

impl !Sync for RunResult

impl Unpin for RunResult

impl !UnwindSafe for RunResult

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> Same<T> for T

type Output = T

Should always be Self

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.