Skip to main content

WiringLayer

Trait WiringLayer 

Source
pub trait WiringLayer:
    'static
    + Send
    + Sync {
    type Input: FromContext;
    type Output: IntoContext;

    // Required methods
    fn layer_name(&self) -> &'static str;
    fn wire<'async_trait>(
        self,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, WiringError>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Wiring layer provides a way to customize the Service by adding new tasks or resources to it.

Structures that implement this trait are advised to specify in doc comments which resources they use or add, and the list of tasks they add.

Required Associated Types§

Required Methods§

Source

fn layer_name(&self) -> &'static str

Identifier of the wiring layer.

Source

fn wire<'async_trait>( self, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, WiringError>> + Send + 'async_trait>>
where Self: 'async_trait,

Performs the wiring process, e.g. adds tasks and resources to the node. This method will be called once during the node initialization.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§