[][src]Struct abscissa_core::component::Registry

pub struct Registry<A: Application + 'static> { /* fields omitted */ }

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]

pub fn register<I>(&mut self, components: I) -> Result<(), FrameworkError> where
    I: IntoIterator<Item = Box<dyn Component<A>>>, 
[src]

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]

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]

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]

Shutdown components (in the reverse order they were started)

pub fn get_downcast_ref<C>(&self) -> Option<&C> where
    C: Component<A>, 
[src]

Get a component reference by its type

pub fn get_downcast_mut<C>(&mut self) -> Option<&mut C> where
    C: Component<A>, 
[src]

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]

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]

impl<T> AsAny for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.