pub struct TaskRegistry { /* private fields */ }Expand description
Task registry for mapping task names to executors
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
Sourcepub fn with_auto_registered() -> Result<Self, Box<dyn Error + Send + Sync>>
Available on crate feature auto-register only.
pub fn with_auto_registered() -> Result<Self, Box<dyn Error + Send + Sync>>
auto-register only.Create a new registry with all automatically registered tasks
Sourcepub fn with_auto_registered_and_config(
config: Option<&AutoRegisterConfig>,
) -> Result<Self, Box<dyn Error + Send + Sync>>
Available on crate feature auto-register only.
pub fn with_auto_registered_and_config( config: Option<&AutoRegisterConfig>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
auto-register only.Create a new registry with all automatically registered tasks and configuration
Sourcepub fn auto_register_tasks(&self) -> Result<(), Box<dyn Error + Send + Sync>>
Available on crate feature auto-register only.
pub fn auto_register_tasks(&self) -> Result<(), Box<dyn Error + Send + Sync>>
auto-register only.Register all tasks that have been submitted via the inventory pattern
Sourcepub fn auto_register_tasks_with_config(
&self,
_config: Option<&AutoRegisterConfig>,
) -> Result<(), Box<dyn Error + Send + Sync>>
Available on crate feature auto-register only.
pub fn auto_register_tasks_with_config( &self, _config: Option<&AutoRegisterConfig>, ) -> Result<(), Box<dyn Error + Send + Sync>>
auto-register only.Register all tasks with optional configuration
Sourcepub fn register_with_name<T>(
&self,
task_name: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>where
T: Task + 'static,
pub fn register_with_name<T>(
&self,
task_name: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>where
T: Task + 'static,
Register a task type with explicit name
Sourcepub async fn execute(&self, task_name: &str, payload: Vec<u8>) -> TaskResult
pub async fn execute(&self, task_name: &str, payload: Vec<u8>) -> TaskResult
Execute a task by name
Sourcepub fn registered_tasks(&self) -> Vec<String>
pub fn registered_tasks(&self) -> Vec<String>
Get list of registered task names
Trait Implementations§
Auto 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