pub trait RoomProvider<ClientToServerMessage, ServerToClientMessage> {
type ServerToClientStream: Stream<Item = ServerToClientMessage> + Unpin + Send + 'static;
type FinishFuture: Future<Output = ()> + Unpin + Send + 'static;
// Required methods
fn add(
&mut self,
client_to_server_stream: impl Stream<Item = ClientToServerMessage> + Unpin + Send + 'static,
) -> Self::ServerToClientStream;
fn get_finish_signal(&mut self) -> Self::FinishFuture;
}Expand description
Abstract of a duel.
Implementing this trait means it can accept a stream of ClientToServerMessage and
return a stream of ServerToClientMessage.
Usually ClientToServerMessage is a derived type of ctos::Message, and
ServerToClientMessage is a derived type of stoc::Message.
Required Associated Types§
Sourcetype ServerToClientStream: Stream<Item = ServerToClientMessage> + Unpin + Send + 'static
type ServerToClientStream: Stream<Item = ServerToClientMessage> + Unpin + Send + 'static
The stream of messages sent back to the client.
Required Methods§
Sourcefn add(
&mut self,
client_to_server_stream: impl Stream<Item = ClientToServerMessage> + Unpin + Send + 'static,
) -> Self::ServerToClientStream
fn add( &mut self, client_to_server_stream: impl Stream<Item = ClientToServerMessage> + Unpin + Send + 'static, ) -> Self::ServerToClientStream
Add a client-to-server stream and return the corresponding server-to-client stream.
Sourcefn get_finish_signal(&mut self) -> Self::FinishFuture
fn get_finish_signal(&mut self) -> Self::FinishFuture
Get a future that resolves when the room finishes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".