Skip to main content

Facade

Trait Facade 

Source
pub trait Facade {
    type Accessor: Send + Sync + 'static;

    // Provided methods
    fn instance() -> Arc<Self::Accessor> ⓘ { ... }
    fn try_instance() -> Option<Arc<Self::Accessor>> { ... }
}
Expand description

A static proxy onto a container-resolved service.

Implementors are zero-sized marker types; all the behaviour lives in the Accessor they resolve.

Required Associated Types§

Source

type Accessor: Send + Sync + 'static

The service this facade forwards to.

Provided Methods§

Source

fn instance() -> Arc<Self::Accessor> ⓘ

Resolve the underlying service.

§Panics

If no application is installed, or the accessor is not bound in it. Both are configuration bugs: a facade whose service was never registered can never work, so it says so rather than propagating an error into every caller.

Source

fn try_instance() -> Option<Arc<Self::Accessor>>

Resolve the underlying service, or None if the application or the binding is missing. For code that must degrade rather than panic.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§