ServerStarter

Trait ServerStarter 

Source
pub trait ServerStarter {
    // Required methods
    fn server_type(&self) -> ServerType;
    fn port(&self) -> u16;
    fn start_server(
        self,
    ) -> impl Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send;
}
Expand description

Common server traits for consistent startup behavior

This trait allows different server implementations (HTTP, WebSocket, gRPC) to be started using a unified interface.

Required Methods§

Source

fn server_type(&self) -> ServerType

Get the server type

Source

fn port(&self) -> u16

Get the port this server will bind to

Source

fn start_server( self, ) -> impl Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send

Start the server (implementation-specific)

Returns a future that resolves when the server is running or fails to start.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§