Struct ioc::Container [] [src]

pub struct Container<Key, SvcBase: ?Sized> {
    // some fields omitted
}

Methods

impl<Key, SvcBase: ?Sized> Container<Key, SvcBase> where Key: Key, SvcBase: Any
[src]

fn new() -> Self

fn register_service(&mut self, key: Key, svc: Box<SvcBase>) -> &mut Self

fn register<Svc>(&mut self, svc: Svc) -> &mut Self where Svc: Service<Key=Key>, Box<Svc>: Into<Box<SvcBase>>

NOTE: The Box<Svc>: Into<Box<Base>>-clause is needed due to rusts lack of HKT or a Coercible-trait (to name two solutions).

fn services(&self) -> &BTreeMap<Key, RwLock<Box<SvcBase>>>

fn get_service(&self, key: &Key) -> Option<&RwLock<Box<SvcBase>>>

fn read_service_base<'a>(&'a self, key: &'a Key) -> Result<RwLockReadGuard<Box<SvcBase>>, Error<'a, Key>>

fn write_service_base<'a>(&'a self, key: &'a Key) -> Result<RwLockWriteGuard<Box<SvcBase>>, Error<'a, Key>>

fn read_service<'a, Svc>(&'a self, key: &'a Key) -> Result<ReadGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Any, SvcBase: Downcast<Svc>

fn write_service<'a, Svc>(&'a self, key: &'a Key) -> Result<WriteGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Any, SvcBase: Downcast<Svc>

fn read<'a, Svc>(&'a self) -> Result<ReadGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Service<Key=Key>, SvcBase: Downcast<Svc>

fn write<'a, Svc>(&'a self) -> Result<WriteGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Service<Key=Key>, SvcBase: Downcast<Svc>

fn try_read_service_base<'a>(&'a self, key: &'a Key) -> Result<RwLockReadGuard<Box<SvcBase>>, Error<'a, Key>>

fn try_write_service_base<'a>(&'a self, key: &'a Key) -> Result<RwLockWriteGuard<Box<SvcBase>>, Error<'a, Key>>

fn try_read_service<'a, Svc>(&'a self, key: &'a Key) -> Result<ReadGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Any, SvcBase: Downcast<Svc>

fn try_write_service<'a, Svc>(&'a self, key: &'a Key) -> Result<WriteGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Any, SvcBase: Downcast<Svc>

fn try_read<'a, Svc>(&'a self) -> Result<ReadGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Service<Key=Key>, SvcBase: Downcast<Svc>

fn try_write<'a, Svc>(&'a self) -> Result<WriteGuard<Svc, SvcBase>, Error<'a, Key>> where Svc: Service<Key=Key>, SvcBase: Downcast<Svc>

fn resolve<'a, M>(&'a self) -> Result<M::Ret, Error<Key>> where M: Method<'a, Key, SvcBase>