Skip to main content

HandlerFactory

Trait HandlerFactory 

Source
pub trait HandlerFactory:
    Send
    + Sync
    + 'static {
    type Handler: Handler;

    // Required method
    fn create(&self, command_tx: CommandTx) -> Self::Handler;
}
Expand description

Factory trait for constructing Handler implementations.

Separating construction from the handler trait enables dependency injection and cleaner initialization patterns.

Required Associated Types§

Source

type Handler: Handler

The concrete handler type produced by this factory.

Required Methods§

Source

fn create(&self, command_tx: CommandTx) -> Self::Handler

Create a new handler instance, passing the command sender so the handler can issue commands back to the WebSocket client.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§