pub trait Environment:
Send
+ Sync
+ Debug {
// Required methods
fn target_operations(&self) -> Option<u64>;
fn timeout_seconds(&self) -> Option<u64>;
fn actor_runners<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Vec<ActorRunner>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reset<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn panic_hook(&self) -> Option<Box<dyn Fn() + Sync + Send + 'static>> { ... }
}Expand description
Every stress test must implement this trait exactly once and pass it to run_test(). The test loop uses these methods to drive the stress test.
The environment is responsible for:
- creating actors that run during the stress test
- creating a new instance when an actor requests one
- specifying success criteria for the test (num operations or timeout)
Required Methods§
Sourcefn target_operations(&self) -> Option<u64>
fn target_operations(&self) -> Option<u64>
Returns the target number of operations to complete before exiting
Sourcefn timeout_seconds(&self) -> Option<u64>
fn timeout_seconds(&self) -> Option<u64>
Returns the number of seconds to wait before exiting
Sourcefn actor_runners<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Vec<ActorRunner>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn actor_runners<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Vec<ActorRunner>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the runners for all the actors
Provided Methods§
Sourcefn panic_hook(&self) -> Option<Box<dyn Fn() + Sync + Send + 'static>>
fn panic_hook(&self) -> Option<Box<dyn Fn() + Sync + Send + 'static>>
An optional hook to invoke when panicking. Can be used to dump additional state. No reference to &self is taken by the function to make it feasible to invoke this hook while a &mut exists on the Environment. Since this is invoked during panic, the function should avoid blocking on locks or other resources.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".