pub struct FakeDriver { /* private fields */ }Expand description
In-memory WorkflowDriver with scripted replies.
Unmatched spawns complete immediately with done:<description>. Rules are
matched by substring against the request description, first match wins.
Implementations§
Source§impl FakeDriver
impl FakeDriver
Sourcepub fn on(&self, needle: &str, reply: FakeReply)
pub fn on(&self, needle: &str, reply: FakeReply)
Add a reply rule: requests whose description contains needle get
reply immediately.
Sourcepub fn on_with_delay(&self, needle: &str, reply: FakeReply, delay: Duration)
pub fn on_with_delay(&self, needle: &str, reply: FakeReply, delay: Duration)
Like FakeDriver::on, but the completion is delivered after delay
(the spawn itself still returns immediately).
Sourcepub fn set_budget(&self, total: Option<u64>, spend_per_task: u64)
pub fn set_budget(&self, total: Option<u64>, spend_per_task: u64)
Configure the budget pool: ceiling plus a fixed spend debited at each spawn (simulating the driver-side reservation of design §5.3).
Sourcepub fn requests(&self) -> Vec<TaskRequest>
pub fn requests(&self) -> Vec<TaskRequest>
Every request received so far, in spawn order.
Sourcepub fn request_descriptions(&self) -> Vec<String>
pub fn request_descriptions(&self) -> Vec<String>
Descriptions of every request, in spawn order.
Sourcepub fn spawn_count(&self) -> usize
pub fn spawn_count(&self) -> usize
Number of admitted spawn calls.
Sourcepub fn events(&self) -> Vec<ProgressEvent>
pub fn events(&self) -> Vec<ProgressEvent>
Every progress event received so far, in emit order.
Sourcepub fn cancel_all_calls(&self) -> usize
pub fn cancel_all_calls(&self) -> usize
How many times cancel_all has been invoked.
Trait Implementations§
Source§impl Debug for FakeDriver
impl Debug for FakeDriver
Source§impl Default for FakeDriver
impl Default for FakeDriver
Source§fn default() -> FakeDriver
fn default() -> FakeDriver
Returns the “default value” for a type. Read more
Source§impl WorkflowDriver for FakeDriver
impl WorkflowDriver for FakeDriver
Source§fn spawn_task<'life0, 'async_trait>(
&'life0 self,
request: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedTask, DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_task<'life0, 'async_trait>(
&'life0 self,
request: TaskRequest,
) -> Pin<Box<dyn Future<Output = Result<SpawnedTask, DriverError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Admit and start one task. Errors surface as a JS throw on the
corresponding
task() call.Source§fn cancel_all(&self)
fn cancel_all(&self)
Cancel every in-flight task belonging to this run. Idempotent.
Source§fn budget(&self) -> BudgetSnapshot
fn budget(&self) -> BudgetSnapshot
Current snapshot of the run’s shared token pool.
Source§fn progress(&self, event: ProgressEvent)
fn progress(&self, event: ProgressEvent)
Receive a script progress event (ordered, synchronous).
Auto Trait Implementations§
impl !Freeze for FakeDriver
impl RefUnwindSafe for FakeDriver
impl Send for FakeDriver
impl Sync for FakeDriver
impl Unpin for FakeDriver
impl UnsafeUnpin for FakeDriver
impl UnwindSafe for FakeDriver
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