pub trait ServerConn {
type ClientMsg: Serialize + for<'de> Deserialize<'de> + Send + 'static;
type ServerMsg: Serialize + for<'de> Deserialize<'de> + Send + 'static;
// Required methods
fn handle_message(&mut self, message: Self::ClientMsg) -> Self::ServerMsg;
fn new() -> Self;
}Expand description
Trait that simplifies the creation of the server side of a socket protocol.
Required Associated Types§
type ClientMsg: Serialize + for<'de> Deserialize<'de> + Send + 'static
type ServerMsg: Serialize + for<'de> Deserialize<'de> + Send + 'static
Required Methods§
Sourcefn handle_message(&mut self, message: Self::ClientMsg) -> Self::ServerMsg
fn handle_message(&mut self, message: Self::ClientMsg) -> Self::ServerMsg
§Handle Message
This function runs every time the server-conn receives a client message. You need to decide what message tp respond with.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".