[−][src]Struct turbulence::unreliable_bincode_channel::UnreliableBincodeChannel
Wraps an UnreliableChannel
together with an internal buffer to allow easily sending message
types serialized with bincode
.
Just like the underlying channel, messages are not guaranteed to arrive, nor are they guaranteed to arrive in order.
Implementations
impl<P> UnreliableBincodeChannel<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<T: Serialize, '_, '_>(
&'_ mut self,
msg: &'_ T
) -> Result<(), SendError>
[src]
&'_ mut self,
msg: &'_ T
) -> Result<(), SendError>
Write the given serializable message type 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<'a, T: Deserialize<'a>>(&'a mut self) -> Result<T, RecvError>
[src]
Receive a deserializable message type as soon as the next message is available.
Auto Trait Implementations
impl<P> !RefUnwindSafe for UnreliableBincodeChannel<P>
impl<P> Send for UnreliableBincodeChannel<P> where
P: Send,
<P as PacketPool>::Packet: Send,
P: Send,
<P as PacketPool>::Packet: Send,
impl<P> Sync for UnreliableBincodeChannel<P> where
P: Sync,
<P as PacketPool>::Packet: Send + Sync,
P: Sync,
<P as PacketPool>::Packet: Send + Sync,
impl<P> Unpin for UnreliableBincodeChannel<P> where
P: Unpin,
<P as PacketPool>::Packet: Unpin,
P: Unpin,
<P as PacketPool>::Packet: Unpin,
impl<P> !UnwindSafe for UnreliableBincodeChannel<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>,