pub trait Backend: 'static + Debug + Send + Sync {
type CustomApi: CustomApi;
type ClientData: Send + Sync + Debug;
type CustomApiDispatcher: CustomApiDispatcher<Self>;
fn initialize<'life0, 'async_trait>(
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + 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 = ConnectionHandling> + 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 = ()> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn client_authenticated<'life0, 'async_trait>(
client: ConnectedClient<Self>,
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
}
Expand description
Tailors the behavior of a server to your needs.
Associated Types
The custom API definition. If you do not wish to have an API, ()
may be provided.
type ClientData: Send + Sync + Debug
type ClientData: Send + Sync + Debug
The type of data that can be stored in
ConnectedClient::set_client_data
. This allows state to be stored
associated with each connected client.
type CustomApiDispatcher: CustomApiDispatcher<Self>
type CustomApiDispatcher: CustomApiDispatcher<Self>
The type that implements the
Dispatcher
trait.
Provided methods
fn initialize<'life0, 'async_trait>(
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn initialize<'life0, 'async_trait>(
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
Invoked once upon the server starting up.
fn client_connected<'life0, 'life1, 'async_trait>(
client: &'life0 ConnectedClient<Self>,
server: &'life1 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ConnectionHandling> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: '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 = ConnectionHandling> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
A client disconnected from the server. This is invoked before authentication has been performed.
fn client_disconnected<'life0, 'async_trait>(
client: ConnectedClient<Self>,
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn client_disconnected<'life0, 'async_trait>(
client: ConnectedClient<Self>,
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
A client disconnected from the server.
fn client_authenticated<'life0, 'async_trait>(
client: ConnectedClient<Self>,
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn client_authenticated<'life0, 'async_trait>(
client: ConnectedClient<Self>,
server: &'life0 CustomServer<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
A client successfully authenticated.