[−][src]Struct icee_container_rs::Container
Container for storing specific services
Stores all services of the same type (trait, int, ...) into an HashMap container wrapped within async Arc
Implementations
impl<T> Container<T>
[src]
pub fn new() -> Self
[src]
Creates a new Container
use icee_container_rs::Container; let mut container = Container::<usize>::new();
pub fn has(&self, name: &str) -> bool
[src]
Checks whether or not a given field is registered
use icee_container_rs::Container; let container = Container::<usize>::new(); let exists = container.has("echo");
pub fn get(&self, name: &str) -> Result<Arc<T>, Error>
[src]
Receives stored field from container
use icee_container_rs::Container; let container = Container::<usize>::new(); let value = container.get("echo");
pub fn set(&mut self, name: &str, service: T) -> Arc<T>
[src]
Stores service into container and returns pointer
use icee_container_rs::Container; use async_std::sync::Arc; let mut container = Container::<usize>::new(); let srv: Arc<usize> = container.set("echo", 666);
pub fn list(&self) -> Vec<String>
[src]
List all available registered services
use icee_container_rs::Container; let container = Container::<usize>::new(); let names = container.list();
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Container<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Container<T> where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> Sync for Container<T> where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> Unpin for Container<T>
[src]
impl<T> UnwindSafe for Container<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub 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>,