Trait udp_connector::ConnectorParam
source · pub trait ConnectorParam {
type TSend: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq;
type TReceive: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq;
const PING_INTERVAL_S: f64 = 0.5f64;
const REQUEST_MISSING_PACKET_INTERVAL_S: f64 = 1f64;
const EMIT_UNCONFIRMED_PACKET_INTERVAL_S: f64 = 1f64;
const RECEIVE_PING_TIMEOUT_S: f64 = _;
const SEND_PING_TIMEOUT_S: f64 = _;
}
Expand description
Settings that are set up for a Connector. This can be used to tweak your Connector at compile-time
Required Associated Types
sourcetype TSend: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq
type TSend: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq
The type that this connector will be sending. This is usually an enum.
// For the server:
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum ServerToClient {
LoginResult { success: bool },
}
struct ConnectorConfig;
impl ConnectorParam for ConnectorConfig {
type TSend = ServerToClient;
// Other fields omitted
}
sourcetype TReceive: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq
type TReceive: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq
The type that this connector will be sending. This is usually an enum.
// For the server:
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum ClientToServer {
Login { params: AuthenticateParams },
}
struct ConnectorConfig;
impl ConnectorParam for ConnectorConfig {
type TReceive = ClientToServer;
// Other fields omitted
}
Provided Associated Constants
sourceconst PING_INTERVAL_S: f64 = 0.5f64
const PING_INTERVAL_S: f64 = 0.5f64
The interval at which pings are being emitted to the other connector. This should be set in relation to RECEIVE_PING_TIMEOUT_S
and SEND_PING_TIMEOUT_S
, and how often you expect to lose packets.
sourceconst REQUEST_MISSING_PACKET_INTERVAL_S: f64 = 1f64
const REQUEST_MISSING_PACKET_INTERVAL_S: f64 = 1f64
The interval at which missing packets are being requested from the connector
sourceconst EMIT_UNCONFIRMED_PACKET_INTERVAL_S: f64 = 1f64
const EMIT_UNCONFIRMED_PACKET_INTERVAL_S: f64 = 1f64
The interval at which unconfirmed packets are being send to the other connector
sourceconst RECEIVE_PING_TIMEOUT_S: f64 = _
const RECEIVE_PING_TIMEOUT_S: f64 = _
The time that it takes before this connector assumes it has lost connection to the other connector
sourceconst SEND_PING_TIMEOUT_S: f64 = _
const SEND_PING_TIMEOUT_S: f64 = _
The time that it takes before this connector assumes it has lost connection to the other connector