Struct wasmtime_fiber::Fiber

source ·
pub struct Fiber<'a, Resume, Yield, Return> { /* private fields */ }

Implementations§

source§

impl<'a, Resume, Yield, Return> Fiber<'a, Resume, Yield, Return>

source

pub fn new( stack: FiberStack, func: impl FnOnce(Resume, &Suspend<Resume, Yield, Return>) -> Return + 'a ) -> Result<Self>

Creates a new fiber which will execute func on the given stack.

This function returns a Fiber which, when resumed, will execute func to completion. When desired the func can suspend itself via Fiber::suspend.

source

pub fn resume(&self, val: Resume) -> Result<Return, Yield>

Resumes execution of this fiber.

This function will transfer execution to the fiber and resume from where it last left off.

Returns true if the fiber finished or false if the fiber was suspended in the middle of execution.

§Panics

Panics if the current thread is already executing a fiber or if this fiber has already finished.

Note that if the fiber itself panics during execution then the panic will be propagated to this caller.

source

pub fn done(&self) -> bool

Returns whether this fiber has finished executing.

source

pub fn stack(&self) -> &FiberStack

Gets the stack associated with this fiber.

Trait Implementations§

source§

impl<A, B, C> Drop for Fiber<'_, A, B, C>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, Resume, Yield, Return> !Freeze for Fiber<'a, Resume, Yield, Return>

§

impl<'a, Resume, Yield, Return> !RefUnwindSafe for Fiber<'a, Resume, Yield, Return>

§

impl<'a, Resume, Yield, Return> !Send for Fiber<'a, Resume, Yield, Return>

§

impl<'a, Resume, Yield, Return> !Sync for Fiber<'a, Resume, Yield, Return>

§

impl<'a, Resume, Yield, Return> Unpin for Fiber<'a, Resume, Yield, Return>

§

impl<'a, Resume, Yield, Return> !UnwindSafe for Fiber<'a, Resume, Yield, Return>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.