[][src]Struct turbulence::reliable_channel::ReliableChannel

pub struct ReliableChannel { /* fields omitted */ }

Turns a stream of unreliable, unordered packets into a reliable in-order stream of data.

Methods

impl ReliableChannel[src]

pub fn new<R, P>(
    runtime: R,
    packet_pool: P,
    settings: Settings,
    incoming: Receiver<P::Packet>,
    outgoing: Sender<P::Packet>
) -> Self where
    R: Runtime + 'static,
    P: PacketPool + Send + 'static,
    P::Packet: Send
[src]

pub async fn write<'_, '_>(&'_ mut self, data: &'_ [u8]) -> Result<usize, Error>[src]

Write the given data to the reliable channel and return once any nonzero amount of data has been written.

In order to ensure that data is written to the channel in a timely manner, ReliableChannel::flush must be called. Without calling ReliableChannel::flush, any pending writes will not be sent until the next send task wakeup.

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

Ensure that any previously written data is sent in a timely manner.

Returns once the sending task has been notified to wake up and will send the written data promptly. Does not actually wait for outgoing packets to be sent before returning.

pub async fn read<'_, '_>(
    &'_ mut self,
    data: &'_ mut [u8]
) -> Result<usize, Error>
[src]

Read any available data. Returns once at least one byte of data has been read.

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.