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, BosonError>
pub fn get_or_err( &self, name: &str, ) -> Result<&'static TaskDescriptor, BosonError>
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() -> TaskRegistry
pub fn auto_discover() -> TaskRegistry
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§fn clone(&self) -> TaskRegistry
fn clone(&self) -> TaskRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§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
Source§impl Deref for TaskRegistry
impl Deref for TaskRegistry
Source§impl DerefMut for TaskRegistry
impl DerefMut 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more