pub struct Fiber<'e> { /* private fields */ }
Expand description
A fiber represents an independent, pausable thread of code execution.
Implementations§
source§impl<'e> Fiber<'e>
impl<'e> Fiber<'e>
sourcepub fn resume<T>(&mut self) -> Result<Option<T>, Error>where
T: TryFromValue,
pub fn resume<T>(&mut self) -> Result<Option<T>, Error>where
T: TryFromValue,
Resumes execution of a fiber. If execution is done already, returns None
.
sourcepub fn trampoline<T>(self) -> Result<T, Error>where
T: TryFromValue,
pub fn trampoline<T>(self) -> Result<T, Error>where
T: TryFromValue,
Resumes execution of a fiber until it’s done evaluating all code. The last result is returned and results from intermediate yields are discarded.
This consumes the fiber, as calling one that’s finished is not useful.