pub struct UnreliableChannel<R, P> where
    R: Runtime,
    P: PacketPool
{ /* private fields */ }
Expand description

Turns a stream of unreliable, unordered packets into a stream of unreliable, unordered messages.

Implementations

Write the given message to the channel.

Messages are coalesced into larger packets before being sent, so in order to guarantee that the message is actually sent, you must call flush.

Messages have a maximum size based on the size of the packets returned from the packet pool. Two bytes are used to encode the length of the message, so the maximum message length is packet.len() - 2, for whatever packet sizes are returned by the pool.

This method is cancel safe, it will never partially send a message, though canceling it may or may not buffer a message to be sent.

Finish sending any unsent coalesced packets.

This must be called to guarantee that any sent messages are actually sent to the outgoing packet stream.

This method is cancel safe.

Receive a message into the provide buffer.

If the received message fits into the provided buffer, this will return Ok(message_len), otherwise it will return Err(RecvError::TooBig).

This method is cancel safe, it will never partially read a message or drop received messages.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.