[][src]Trait lucet_runtime_internals::vmctx::VmctxInternal

pub trait VmctxInternal {
    fn instance(&self) -> &Instance;
unsafe fn instance_mut(&self) -> &mut Instance;
fn try_take_resumed_val<R: Any + 'static>(&self) -> Option<R>;
fn yield_val_try_val<A: Any + 'static, R: Any + 'static>(
        &mut self,
        val: A
    ) -> Option<R>; }

Required methods

fn instance(&self) -> &Instance

Get a reference to the Instance for this guest.

unsafe fn instance_mut(&self) -> &mut Instance

Get a mutable reference to the Instance for this guest.

Safety

Using this method, you could hold on to multiple mutable references to the same Instance. Only use one at a time! This method does not take &mut self because otherwise you could not use orthogonal &mut refs that come from Vmctx, like the heap or terminating the instance.

fn try_take_resumed_val<R: Any + 'static>(&self) -> Option<R>

Try to take and return the value passed to Instance::resume_with_val().

If there is no resumed value, or if the dynamic type check of the value fails, this returns None.

fn yield_val_try_val<A: Any + 'static, R: Any + 'static>(
    &mut self,
    val: A
) -> Option<R>

Suspend the instance, returning a value in RunResult::Yielded to where the instance was run or resumed.

After suspending, the instance may be resumed by calling Instance::resume_with_val() from the host with a value of type R. If resumed with a value of some other type, this returns None.

The dynamic type checks used by the other yield methods should make this explicit option type redundant, however this interface is used to avoid exposing a panic to the C API.

Loading content...

Implementors

impl VmctxInternal for Vmctx[src]

Loading content...