Trait bonsaidb::server::Backend[][src]

pub trait Backend: 'static + Debug + Send + Sync {
    type Error: Error + Send + Sync;
    type ClientData: Send + Sync + Debug;
    fn configure(
        config: ServerConfiguration<Self>
    ) -> Result<ServerConfiguration<Self>, BackendError<Self::Error>> { ... }
fn initialize<'life0, 'async_trait>(
        server: &'life0 CustomServer<Self>
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<Self::Error>>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
fn client_connected<'life0, 'life1, 'async_trait>(
        client: &'life0 ConnectedClient<Self>,
        server: &'life1 CustomServer<Self>
    ) -> Pin<Box<dyn Future<Output = Result<ConnectionHandling, BackendError<Self::Error>>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
fn client_disconnected<'life0, 'async_trait>(
        client: ConnectedClient<Self>,
        server: &'life0 CustomServer<Self>
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<Self::Error>>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
fn client_authenticated<'life0, 'life1, 'async_trait>(
        client: ConnectedClient<Self>,
        session: &'life0 Session,
        server: &'life1 CustomServer<Self>
    ) -> Pin<Box<dyn Future<Output = Result<(), BackendError<Self::Error>>> + Send + 'async_trait, Global>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

Tailors the behavior of a server to your needs.

Associated Types

The error type that can be returned from the backend functions. If a backend doesn’t need an error type, Infallible can be used.

The type of data that can be stored in ConnectedClient::set_client_data. This allows state to be stored associated with each connected client.

Provided methods

Invoked once before the server is initialized.

Invoked once after initialization during Server::open/CustomServer::open.

A client disconnected from the server. This is invoked before authentication has been performed.

A client disconnected from the server.

A client successfully authenticated.

Implementors