pub struct Container<T> { /* private fields */ }
Expand description
Container for storing specific services
Stores all services of the same type (trait, int, …) into an HashMap container wrapped within async Arc
Implementations§
Source§impl<T> Container<T>
impl<T> Container<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Container
use icee_container_rs::Container;
let mut container = Container::<usize>::new();
Sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Checks whether or not a given field is registered
use icee_container_rs::Container;
let container = Container::<usize>::new();
let exists = container.has("echo");
Sourcepub fn get(&self, name: &str) -> Result<Arc<T>, Error>
pub fn get(&self, name: &str) -> Result<Arc<T>, Error>
Receives stored field from container
use icee_container_rs::Container;
let container = Container::<usize>::new();
let value = container.get("echo");
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Container<T>
impl<T> RefUnwindSafe for Container<T>where
T: RefUnwindSafe,
impl<T> Send for Container<T>
impl<T> Sync for Container<T>
impl<T> Unpin for Container<T>
impl<T> UnwindSafe for Container<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more