Enum message_io::network::Transport [−][src]
pub enum Transport { Tcp, FramedTcp, Udp, Ws, }
Expand description
Enum to identified the underlying transport used.
It can be passed to
NetworkController::connect()
and
NetworkController::listen()
methods
to specify the transport used.
Variants
TCP protocol (available through the tcp feature).
As stream protocol, receiving a message from TCP do not imply to read
the entire message.
If you want a packet based way to send over TCP, use FramedTcp
instead.
Tcp framed protocol (available through the tcp feature).
Like TCP, but encoded with a slim frame layer to manage the data as a packet,
instead of as a stream.
It prefixes the message using variable integer encoding with the size of the message.
Most of the time you would want to use this instead of the raw Tcp
.
UDP protocol (available through the udp feature).
Take into account that UDP is not connection oriented and a packet can be lost
or received disordered.
If it is specified in the listener and the address is a Ipv4 in the range of multicast ips
(from 224.0.0.0
to 239.255.255.255
), the listener will be configured in multicast mode.
WebSocket protocol (available through the websocket feature).
If you use a crate::network::RemoteAddr::Str
in the connect()
method,
you can specify an URL with wss
of ws
schemas to connect with or without security.
If you use a crate::network::RemoteAddr::Socket
the socket will be a normal
websocket with the following uri: ws://{SocketAddr}/message-io-default
.
Implementations
Associates an adapter. This method mounts the adapters to be used in the network instance.
Maximum theorical packet payload length available for each transport.
The value returned by this function is the theorical maximum and could not be valid for
all networks.
You can ensure your message not exceeds udp::MAX_INTERNET_PAYLOAD_LEN
in order to be
more cross-platform compatible.
Tell if the transport protocol is a connection oriented protocol.
If it is, Connection
and Disconnection
events will be generated.
Tell if the transport protocol is a packet-based protocol. It implies that any send call corresponds to a data message event. It satisfies that the number of bytes sent are the same as received. The opossite of a packet-based is a stream-based transport (e.g Tcp). In this case, reading a data message event do not imply reading the entire message sent. It is in change of the user to determinate how to read the data.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Transport
impl UnwindSafe for Transport
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V