pub struct Executor { /* private fields */ }Expand description
The executor (design-doc §4.3). !Send — it never leaves the sim thread.
Implementations§
Source§impl Executor
impl Executor
pub fn spawn_named<F>(
&self,
fut: F,
name: Option<&str>,
) -> TaskHandle<F::Output> ⓘwhere
F: Future + 'static,
Sourcepub fn run_until_idle(&self)
pub fn run_until_idle(&self)
Drain the run queue to exhaustion, then return to the simulator.
Port of EventLoop.run (cocotb: _event_loop.py).
Sourcepub fn cancel(&self, id: TaskId)
pub fn cancel(&self, id: TaskId)
Cancel = drop the future (design-doc §4.6). Cleanup happens in Drop impls; there is no exception to catch.
Sourcepub fn cancel_after(&self, watermark: TaskId)
pub fn cancel_after(&self, watermark: TaskId)
Cancel every live task with id >= watermark (the snapshot taken
before the test spawned anything) — the runner uses this to kill
a test’s surviving tasks at test end (design-doc §4.5).
Sourcepub fn watermark(&self) -> TaskId
pub fn watermark(&self) -> TaskId
Current high-water task id (snapshot before starting a test).
pub fn set_failure_sink(&self, f: Box<dyn Fn(&str)>)
pub fn live_tasks(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Executor
impl !Send for Executor
impl !Sync for Executor
impl !UnwindSafe for Executor
impl Freeze for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
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