Trait ServiceFactory

Source
pub trait ServiceFactory<B: Backend> {
    type Service: Service<B>;
    type Err: From<Error<B>>;

    // Required methods
    fn create(container: Container<B>) -> Result<Self::Service, Self::Err>;
    fn open(container: Container<B>) -> Result<Self::Service, Self::Err>;
}
Expand description

Factory used to instantiate a service.

Required Associated Types§

Source

type Service: Service<B>

The service

Source

type Err: From<Error<B>>

Error returned by Self::open and Self::create.

It must be possible to put an Error instance into this error.

Required Methods§

Source

fn create(container: Container<B>) -> Result<Self::Service, Self::Err>

Create a service instance.

Called by Container::create_service the method should create a new Self::Service instance. The created container is passed to this method.

Source

fn open(container: Container<B>) -> Result<Self::Service, Self::Err>

Open a service.

Called by Container::open_service the method should open an existing Self::Service instance. The opened container is passed to this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§