[−][src]Struct turbulence::unreliable_channel::UnreliableChannel
Turns a stream of unreliable, unordered packets into a stream of unreliable, unordered messages.
Implementations
impl<P> UnreliableChannel<P> where
P: PacketPool,
[src]
P: PacketPool,
pub fn new(
packet_pool: P,
incoming: Receiver<P::Packet>,
outgoing: Sender<P::Packet>
) -> Self
[src]
packet_pool: P,
incoming: Receiver<P::Packet>,
outgoing: Sender<P::Packet>
) -> Self
pub async fn send<'_, '_>(&'_ mut self, msg: &'_ [u8]) -> Result<(), SendError>
[src]
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
.
pub async fn flush<'_>(&'_ mut self) -> Result<(), SendError>
[src]
Finish sending any unsent coalesced packets.
This must be called to guarantee that any sent messages are actually sent to the outgoing packet stream.
pub async fn recv<'_, '_>(
&'_ mut self,
msg: &'_ mut [u8]
) -> Result<usize, RecvError>
[src]
&'_ mut self,
msg: &'_ mut [u8]
) -> Result<usize, RecvError>
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)
.
Auto Trait Implementations
impl<P> !RefUnwindSafe for UnreliableChannel<P>
impl<P> Send for UnreliableChannel<P> where
P: Send,
<P as PacketPool>::Packet: Send,
P: Send,
<P as PacketPool>::Packet: Send,
impl<P> Sync for UnreliableChannel<P> where
P: Sync,
<P as PacketPool>::Packet: Send + Sync,
P: Sync,
<P as PacketPool>::Packet: Send + Sync,
impl<P> Unpin for UnreliableChannel<P> where
P: Unpin,
<P as PacketPool>::Packet: Unpin,
P: Unpin,
<P as PacketPool>::Packet: Unpin,
impl<P> !UnwindSafe for UnreliableChannel<P>
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,
pub 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.
pub 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>,