[−][src]Struct turbulence::reliable_channel::ReliableChannel
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]
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,
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]
&'_ mut self,
data: &'_ mut [u8]
) -> Result<usize, Error>
Read any available data. Returns once at least one byte of data has been read.
Auto Trait Implementations
impl !RefUnwindSafe for ReliableChannel
impl Send for ReliableChannel
impl Sync for ReliableChannel
impl Unpin for ReliableChannel
impl !UnwindSafe for ReliableChannel
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,