[][src]Struct orbtk::prelude::Registry

pub struct Registry { /* fields omitted */ }

The struct Registry represents a global registry. It is used to register and call global elements like services.

Implementations

impl Registry[src]

pub fn new() -> Registry[src]

Creates a service registry with an empty Registry map.

pub fn register<C>(&mut self, key: impl Into<String>, service: C) where
    C: Component
[src]

Register a new Registry with the given key.

pub fn get<C>(&self, key: &str) -> &C where
    C: Component
[src]

Gets an element from the registry.

Panics

Panics if the there is no element for the given key or the given service type is wrong.

pub fn get_mut<C>(&mut self, key: &str) -> &mut C where
    C: Component
[src]

Gets a mutable reference of the requested element.

Panics

Panics if the there is no service for the given key or the given service type is wrong.

pub fn try_get<C>(&self, key: &str) -> Option<&C> where
    C: Component
[src]

Try to get an element from the registry.

pub fn try_get_mut<C>(&mut self, key: &str) -> Option<&mut C> where
    C: Component
[src]

Try to get an element from the registry.

pub fn len(&self) -> usize[src]

Returns the number of elements in the registry.

pub fn is_empty(&self) -> bool[src]

Returns true if the registry contains no elements.

Trait Implementations

impl Default for Registry[src]

Auto Trait Implementations

impl !RefUnwindSafe for Registry

impl !Send for Registry

impl !Sync for Registry

impl Unpin for Registry

impl !UnwindSafe for Registry

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

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

impl<E> Component for E where
    E: Any
[src]

impl<T> From<T> for T[src]

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

impl<T> SetParameter for T

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,