[][src]Struct turbulence::reliable_bincode_channel::ReliableBincodeChannel

pub struct ReliableBincodeChannel { /* fields omitted */ }

Wraps a ReliableChannel together with an internal buffer to allow easily sending message types serialized with bincode.

Messages are guaranteed to arrive, and are guaranteed to be in order. Messages have a maximum length, but this maximum size can be much larger than the size of an individual packet (up to MAX_MESSAGE_LEN large).

Methods

impl ReliableBincodeChannel[src]

pub fn new(channel: ReliableChannel, max_message_len: usize) -> Self[src]

Create a new ReliableBincodeChannel with a maximum message size of max_message_len.

pub async fn send<'_, '_, T: Serialize>(
    &'_ mut self,
    msg: &'_ T
) -> Result<(), Error>
[src]

Write the given message to the reliable channel.

In order to ensure that messages are sent in a timely manner, flush must be called after calling this method. Without calling flush, any pending writes will not be sent until the next automatic sender task wakeup.

pub async fn flush<'_>(&'_ mut self) -> Result<(), Error>[src]

Ensure that any previously sent messages are sent as soon as possible.

pub async fn recv<'a, T: Deserialize<'a>>(&'a mut self) -> Result<T, Error>[src]

Read the next available incoming message.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.