Struct ora_test::TestWorkerPool
source · pub struct TestWorkerPool { /* private fields */ }
Expand description
A worker pool that can be used to test worker implementations.
Implementations§
source§impl TestWorkerPool
impl TestWorkerPool
sourcepub fn register_worker(
&mut self,
worker: Arc<dyn RawWorker + Send + Sync>
) -> &mut Self
pub fn register_worker( &mut self, worker: Arc<dyn RawWorker + Send + Sync> ) -> &mut Self
Add a worker to the test pool.
Panics
Panics if a worker with a matching WorkerSelector
already exists.
sourcepub fn spawn_task<T>(
&mut self,
task: TaskDefinition<T>
) -> Option<TaskHandle<T>>where
T: Send + 'static,
pub fn spawn_task<T>( &mut self, task: TaskDefinition<T> ) -> Option<TaskHandle<T>>where T: Send + 'static,
Spawn a task onto the worker pool, immediately run it with a
registered and return a TaskHandle
for it.
It returns None
if there are no suitable workers registered.
Panics
Panics if not called inside a tokio
runtime.
Trait Implementations§
source§impl Debug for TestWorkerPool
impl Debug for TestWorkerPool
source§impl Default for TestWorkerPool
impl Default for TestWorkerPool
source§fn default() -> TestWorkerPool
fn default() -> TestWorkerPool
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for TestWorkerPool
impl Send for TestWorkerPool
impl Sync for TestWorkerPool
impl Unpin for TestWorkerPool
impl !UnwindSafe for TestWorkerPool
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