[−][src]Struct abscissa_core::component::Registry
The component registry provides a system for runtime registration of application components which can interact with each other dynamically.
Components are sorted according to a dependency ordering, started in-order, and at application termination time, shut down in reverse order.
Methods
impl<A> Registry<A> where
A: Application + 'static,
[src]
A: Application + 'static,
pub fn register<I>(&mut self, components: I) -> Result<(), FrameworkError> where
I: IntoIterator<Item = Box<dyn Component<A>>>,
[src]
I: IntoIterator<Item = Box<dyn Component<A>>>,
Register components, determining their dependency order
pub fn after_config(&mut self, config: &A::Cfg) -> Result<(), FrameworkError>
[src]
Callback fired by application when configuration has been loaded
pub fn len(&self) -> usize
[src]
Get the number of currently registered components
pub fn is_empty(&self) -> bool
[src]
Is the registry empty?
pub fn get(&self, handle: Handle) -> Option<&dyn Component<A>>
[src]
Get a component reference by its handle
pub fn get_mut(
&mut self,
handle: Handle
) -> Option<&mut (dyn Component<A> + 'static)>
[src]
&mut self,
handle: Handle
) -> Option<&mut (dyn Component<A> + 'static)>
Get a mutable component reference by its handle
pub fn get_handle_by_id(&self, id: Id) -> Option<Handle>
[src]
Get a component's handle by its ID
pub fn get_handle(&self, component: &dyn Component<A>) -> Option<Handle>
[src]
Get the handle for the given component, if it's registered
pub fn get_by_id(&self, id: Id) -> Option<&dyn Component<A>>
[src]
Get a component ref by its ID
pub fn get_mut_by_id(
&mut self,
id: Id
) -> Option<&mut (dyn Component<A> + 'static)>
[src]
&mut self,
id: Id
) -> Option<&mut (dyn Component<A> + 'static)>
Get a mutable component ref by its ID
pub fn iter(&self) -> Iter<A>
[src]
Iterate over the components.
pub fn iter_mut(&mut self) -> IterMut<A>
[src]
Iterate over the components mutably.
pub fn shutdown(
&self,
app: &A,
shutdown: Shutdown
) -> Result<(), FrameworkError>
[src]
&self,
app: &A,
shutdown: Shutdown
) -> Result<(), FrameworkError>
Shutdown components (in the reverse order they were started)
pub fn get_downcast_ref<C>(&self) -> Option<&C> where
C: Component<A>,
[src]
C: Component<A>,
Get a component reference by its type
pub fn get_downcast_mut<C>(&mut self) -> Option<&mut C> where
C: Component<A>,
[src]
C: Component<A>,
Get a mutable component reference by its type
Trait Implementations
impl<A: Debug + Application + 'static> Debug for Registry<A>
[src]
impl<A> Default for Registry<A> where
A: Application + 'static,
[src]
A: Application + 'static,
Auto Trait Implementations
impl<A> !RefUnwindSafe for Registry<A>
impl<A> Send for Registry<A>
impl<A> Sync for Registry<A>
impl<A> Unpin for Registry<A>
impl<A> !UnwindSafe for Registry<A>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
[src]
T: Any,
fn as_any(&Self) -> &(dyn Any + 'static)
[src]
fn as_mut_any(&mut Self) -> &mut (dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,