Trait ioc::Container [] [src]

pub trait Container<'a>: Any + Sized {
    type Key: Key;
    type ServiceBase: ?Sized + Any;
    type ReadGuardBase: Deref<Target=Box<Self::ServiceBase>> + 'a;
    type WriteGuardBase: DerefMut<Target=Box<Self::ServiceBase>> + 'a;
    fn read_service_base(&'a self, key: &'a Self::Key) -> Result<Self::ReadGuardBase, Error<'a, Self::Key>>;
    fn write_service_base(&'a self, key: &'a Self::Key) -> Result<Self::WriteGuardBase, Error<'a, Self::Key>>;
    fn read_all(&'a self) -> Result<BTreeMap<&'a Self::Key, Self::ReadGuardBase>, Error<'a, Self::Key>>;
    fn write_all(&'a self) -> Result<BTreeMap<&'a Self::Key, Self::WriteGuardBase>, Error<'a, Self::Key>>;

    fn read_service<Svc>(&'a self, key: &'a Self::Key) -> Result<ReadGuard<Svc, Self::ServiceBase, Self::ReadGuardBase>, Error<'a, Self::Key>> where Svc: Any, Self::ServiceBase: Downcast<Svc> { ... }
    fn write_service<Svc>(&'a self, key: &'a Self::Key) -> Result<WriteGuard<Svc, Self::ServiceBase, Self::WriteGuardBase>, Error<'a, Self::Key>> where Svc: Any, Self::ServiceBase: Downcast<Svc> { ... }
    fn read<Svc>(&'a self) -> Result<ReadGuard<Svc, Self::ServiceBase, Self::ReadGuardBase>, Error<'a, Self::Key>> where Svc: Service<Key=Self::Key>, Self::ServiceBase: Downcast<Svc> { ... }
    fn write<Svc>(&'a self) -> Result<WriteGuard<Svc, Self::ServiceBase, Self::WriteGuardBase>, Error<'a, Self::Key>> where Svc: Service<Key=Self::Key>, Self::ServiceBase: Downcast<Svc> { ... }
    fn create_factory_object<Obj, Svc>(&'a self, svc: &'a Self::Key) -> Result<Obj, Error<'a, Self::Key>> where Svc: FactoryBase<'a, Self, Obj>, Self::ServiceBase: Downcast<Svc> { ... }
    fn create<Obj>(&'a self) -> Result<Obj, Error<'a, Self::Key>> where Obj: FactoryObject<Key=Self::Key>, Obj::Factory: FactoryBase<'a, Self, Obj>, Self::ServiceBase: Downcast<Obj::Factory> { ... }
    fn resolve<M>(&'a self) -> Result<M::Ret, Error<'a, Self::Key>> where M: Method<'a, Self> { ... }
}

Associated Types

type Key: Key

type ServiceBase: ?Sized + Any

type ReadGuardBase: Deref<Target=Box<Self::ServiceBase>> + 'a

type WriteGuardBase: DerefMut<Target=Box<Self::ServiceBase>> + 'a

Required Methods

fn read_service_base(&'a self, key: &'a Self::Key) -> Result<Self::ReadGuardBase, Error<'a, Self::Key>>

fn write_service_base(&'a self, key: &'a Self::Key) -> Result<Self::WriteGuardBase, Error<'a, Self::Key>>

fn read_all(&'a self) -> Result<BTreeMap<&'a Self::Key, Self::ReadGuardBase>, Error<'a, Self::Key>>

fn write_all(&'a self) -> Result<BTreeMap<&'a Self::Key, Self::WriteGuardBase>, Error<'a, Self::Key>>

Provided Methods

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

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

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

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

fn create_factory_object<Obj, Svc>(&'a self, svc: &'a Self::Key) -> Result<Obj, Error<'a, Self::Key>> where Svc: FactoryBase<'a, Self, Obj>, Self::ServiceBase: Downcast<Svc>

fn create<Obj>(&'a self) -> Result<Obj, Error<'a, Self::Key>> where Obj: FactoryObject<Key=Self::Key>, Obj::Factory: FactoryBase<'a, Self, Obj>, Self::ServiceBase: Downcast<Obj::Factory>

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

Implementors