gatekeeper/
server_command.rs

1//! Server control command
2//!
3use std::fmt;
4use std::net::SocketAddr;
5
6use crate::session::SessionId;
7
8pub enum ServerCommand<T> {
9    /// terminate
10    Terminate,
11    /// connected stream and client address
12    Connect(T, SocketAddr),
13    Disconnect(SessionId),
14}
15
16impl<T> fmt::Debug for ServerCommand<T> {
17    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18        use ServerCommand::*;
19        match self {
20            Terminate => write!(f, "Terminate"),
21            Connect(_, addr) => write!(f, "Connect(_, {})", addr),
22            Disconnect(id) => write!(f, "Disconnect({})", id),
23        }
24    }
25}