pub struct Scheduler<F: FnMut() -> VM> { /* private fields */ }Expand description
The cooperative goroutine scheduler. Construct with Scheduler::new, then
Scheduler::run.
Implementations§
Source§impl<F: FnMut() -> VM> Scheduler<F>
impl<F: FnMut() -> VM> Scheduler<F>
Sourcepub fn with_recv_zero(self, zero: Value) -> Self
pub fn with_recv_zero(self, zero: Value) -> Self
Set the value a receive on a closed, empty channel yields (default 0).
Sourcepub fn run(self, main_vm: VM) -> Result<(), SchedError>
pub fn run(self, main_vm: VM) -> Result<(), SchedError>
Drive main_vm (goroutine 0) and every goroutine it spawns to completion.
Returns when the main goroutine finishes (Go semantics: the program exits
when main returns) or on deadlock / panic.
Sourcepub fn run_capturing(
self,
main_vm: VM,
global: &str,
) -> Result<Option<Value>, SchedError>
pub fn run_capturing( self, main_vm: VM, global: &str, ) -> Result<Option<Value>, SchedError>
Like Scheduler::run, but afterward returns the value of global from
the main goroutine (None if the program has no such global). Lets a
frontend read main’s result out of a scheduled run.
Auto Trait Implementations§
impl<F> !RefUnwindSafe for Scheduler<F>
impl<F> !Sync for Scheduler<F>
impl<F> !UnwindSafe for Scheduler<F>
impl<F> Freeze for Scheduler<F>where
F: Freeze,
impl<F> Send for Scheduler<F>where
F: Send,
impl<F> Unpin for Scheduler<F>where
F: Unpin,
impl<F> UnsafeUnpin for Scheduler<F>where
F: UnsafeUnpin,
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