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: DefaultStack, entry: F) -> Selfwhere
F: FnOnce() + 'static,
pub fn new<F>(stack: DefaultStack, 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 yielder.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether the entry function has completed.
Sourcepub fn into_stack(self) -> DefaultStack
pub fn into_stack(self) -> DefaultStack
Reclaims the stack after completion so it can be reused.
Panics if incomplete; the fiber is still reclaimed with its yielder mounted.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Fiber
impl !Send for Fiber
impl !Sync for Fiber
impl !UnwindSafe 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