pub struct TaskRegistry { /* private fields */ }Expand description
Registry mapping task names to type-erased handlers.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
Sourcepub fn get(&self, name: &str) -> Option<&TaskHandler>
pub fn get(&self, name: &str) -> Option<&TaskHandler>
Look up a handler by task name.
Sourcepub async fn dispatch(
&self,
name: &str,
payload: Value,
ctx: Arc<TaskContext>,
) -> TaskResult<Value>
pub async fn dispatch( &self, name: &str, payload: Value, ctx: Arc<TaskContext>, ) -> TaskResult<Value>
Execute a task by name with the given payload.
Trait Implementations§
Source§impl Clone for TaskRegistry
impl Clone for TaskRegistry
Source§fn clone(&self) -> TaskRegistry
fn clone(&self) -> TaskRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TaskRegistry
impl !RefUnwindSafe for TaskRegistry
impl Send for TaskRegistry
impl Sync for TaskRegistry
impl Unpin for TaskRegistry
impl UnsafeUnpin for TaskRegistry
impl !UnwindSafe for TaskRegistry
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