[−][src]Struct orbtk_api::widget_base::Registry
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() -> Self
[src]
Creates a service registry with an empty Registry map.
pub fn register<C: Component>(&mut self, key: impl Into<String>, service: C)
[src]
Register a new Registry with the given key.
pub fn get<C: Component>(&self, key: &str) -> &C
[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: Component>(&mut self, key: &str) -> &mut C
[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: Component>(&self, key: &str) -> Option<&C>
[src]
Try to get an element from the registry.
pub fn try_get_mut<C: Component>(&mut self, key: &str) -> Option<&mut C>
[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
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]
T: 'static + ?Sized,
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<E> Component for E where
E: Any,
[src]
E: Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
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>,