pub struct TaskRegistry { /* private fields */ }Expand description
Registry of tasks discovered via inventory (auto_discover) or register.
Prefer BosonBuilder::auto_registry at boot.
Implementations§
Source§impl TaskRegistry
impl TaskRegistry
Sourcepub fn get_or_err(&self, name: &str) -> Result<&'static TaskDescriptor>
pub fn get_or_err(&self, name: &str) -> Result<&'static TaskDescriptor>
Look up a task by name, returning an error if not found.
§Errors
Returns BosonError::TaskNotFound when the name is absent.
Sourcepub fn sorted_task_names(&self) -> Vec<&str>
pub fn sorted_task_names(&self) -> Vec<&str>
Task names in sorted order.
Source§impl TaskRegistry
impl TaskRegistry
pub fn new() -> Self
pub fn auto_discover() -> Self
pub fn register(&mut self, item: &'static TaskDescriptor)
Methods from Deref<Target = Registry<TaskDescriptor>>§
Sourcepub fn register(&mut self, item: &'static T)
pub fn register(&mut self, item: &'static T)
Insert a descriptor. If a descriptor with the same key already exists, it is replaced (last-write-wins).
Sourcepub fn get(&self, key: &str) -> Option<&'static T>
pub fn get(&self, key: &str) -> Option<&'static T>
Look up an item by registry key.
Sourcepub fn iter(&self) -> impl Iterator<Item = &'static T>
pub fn iter(&self) -> impl Iterator<Item = &'static T>
Iterates over all registered descriptors in arbitrary order.
Trait Implementations§
Source§impl Clone for TaskRegistry
impl Clone for TaskRegistry
Source§impl Debug for TaskRegistry
impl Debug for TaskRegistry
Source§impl Default for TaskRegistry
impl Default for TaskRegistry
Source§impl Deref for TaskRegistry
impl Deref for TaskRegistry
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