Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin:
    Policy
    + Send
    + Sync
    + Sized
    + 'static {
    type Config: DeserializeOwned + Default + Send + 'static;
    type Error: Error + Send + Sync + 'static;
    type Context: Context;
    type Resources: Send + Sync + 'static;

    // Required methods
    fn resources(&self) -> Arc<Self::Resources> ⓘ;
    fn prepare(config: Self::Config) -> Result<Self, Self::Error>;
    fn initialize(
        &mut self,
        context: &Self::Context,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn bind_operations(
        &self,
        table: &mut WireTable<Self::Context>,
    ) -> Result<(), ServingError>;
    fn stop(
        &mut self,
        context: &Self::Context,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn cleanup(
        &mut self,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn register(_registrar: &mut Registrar) -> Result<(), RegistrationError> { ... }
    fn attachment(&self) -> Option<Arc<dyn Attachment<Self::Context>>> { ... }
}

Required Associated Types§

Source

type Config: DeserializeOwned + Default + Send + 'static

Source

type Error: Error + Send + Sync + 'static

Source

type Context: Context

Source

type Resources: Send + Sync + 'static

Required Methods§

Source

fn resources(&self) -> Arc<Self::Resources> ⓘ

Source

fn prepare(config: Self::Config) -> Result<Self, Self::Error>

Source

fn initialize( &mut self, context: &Self::Context, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Source

fn bind_operations( &self, table: &mut WireTable<Self::Context>, ) -> Result<(), ServingError>

Source

fn stop( &mut self, context: &Self::Context, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Source

fn cleanup(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Source

fn register(_registrar: &mut Registrar) -> Result<(), RegistrationError>

Source

fn attachment(&self) -> Option<Arc<dyn Attachment<Self::Context>>>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§