pub struct TaskRegistry { /* private fields */ }Expand description
Registry holding all known task definitions for this application.
Tasks must be registered before they can be invoked. Supports both
typed tasks (via Task trait) and legacy closure-based tasks.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
Sourcepub fn register_typed<T: Task>(&mut self, task: T) -> RustvelloResult<()>
pub fn register_typed<T: Task>(&mut self, task: T) -> RustvelloResult<()>
Register a typed task. Returns error if the task ID is already registered.
Sourcepub fn register_foreign<F: ForeignTask>(
&mut self,
task: F,
) -> RustvelloResult<()>
pub fn register_foreign<F: ForeignTask>( &mut self, task: F, ) -> RustvelloResult<()>
Register a foreign task stub. Returns error if the task ID is already registered or if the task ID does not have a non-empty language (i.e. is not foreign).
Sourcepub fn register(&mut self, definition: TaskDefinition) -> RustvelloResult<()>
pub fn register(&mut self, definition: TaskDefinition) -> RustvelloResult<()>
Register a legacy task definition. Returns error if already registered.
Sourcepub fn get_dyn(&self, task_id: &TaskId) -> Option<Arc<dyn DynTask>>
pub fn get_dyn(&self, task_id: &TaskId) -> Option<Arc<dyn DynTask>>
Get a type-erased task by ID.
Sourcepub fn get(&self, task_id: &TaskId) -> Option<Arc<TaskDefinition>>
pub fn get(&self, task_id: &TaskId) -> Option<Arc<TaskDefinition>>
Get a legacy task definition by ID (backward compatibility).
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Debug for TaskRegistry
impl Debug for TaskRegistry
Source§impl Default for TaskRegistry
impl Default for TaskRegistry
Source§fn default() -> TaskRegistry
fn default() -> TaskRegistry
Returns the “default value” for a type. Read more
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