pub struct Fiber { /* private fields */ }Expand description
One carrier-local stackful execution context.
ⓘ
fn require_send<T: Send>() {}
require_send::<vthread_stack::Fiber>();Implementations§
Source§impl Fiber
impl Fiber
Sourcepub fn new<F>(stack: MappedStack, entry: F) -> Selfwhere
F: FnOnce() + 'static,
pub fn new<F>(stack: MappedStack, entry: F) -> Selfwhere
F: FnOnce() + 'static,
Creates a fiber on an already allocated stack.
Sourcepub fn resume(&mut self) -> FiberState
pub fn resume(&mut self) -> FiberState
Mounts the fiber until it suspends or completes.
Panics if the fiber has already completed, without mounting its old control block.
Sourcepub fn resume_with(&mut self, resume: Resume) -> FiberState
pub fn resume_with(&mut self, resume: Resume) -> FiberState
Mounts the fiber and delivers a decision to its last suspension point.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether the entry function has completed.
Sourcepub fn into_stack(self) -> MappedStack
pub fn into_stack(self) -> MappedStack
Reclaims the stack after completion so it can be reused.
Panics if incomplete; suspended frames unwind on their fiber, while an unstarted entry is reclaimed on the caller’s stack.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Fiber
impl !Send for Fiber
impl !Sync for Fiber
impl !UnwindSafe for Fiber
impl Forget for Fiber
impl Freeze for Fiber
impl Unpin for Fiber
impl UnsafeUnpin for Fiber
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more