Skip to main content

Observer

Trait Observer 

Source
pub trait Observer<H: Send + Sync + 'static = Supervisor>:
    Sized
    + Send
    + 'static {
    type Error: Error + Send + Sync + 'static;

    const ID: &'static str;
    const INTERVAL: Duration;
    const DESCRIPTION: &'static str = "";
    const STREAMS: &'static [Entry] = _;
    const DEMAND_KEYS: &'static [DemandKey] = _;
    const ACTIVATION: Activation = Activation::Plugin;

    // Required methods
    fn initialize(
        resources: &ExecutionContext,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
    fn observe(
        &mut self,
        ctx: &ObserverContext<'_, H>,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
    fn cleanup(
        &mut self,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
}

Required Associated Constants§

Source

const ID: &'static str

Source

const INTERVAL: Duration

Provided Associated Constants§

Source

const DESCRIPTION: &'static str = ""

Source

const STREAMS: &'static [Entry] = _

Source

const DEMAND_KEYS: &'static [DemandKey] = _

Source

const ACTIVATION: Activation = Activation::Plugin

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn initialize( resources: &ExecutionContext, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Source

fn observe( &mut self, ctx: &ObserverContext<'_, H>, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Source

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

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§