[−][src]Struct turbulence::reliable_bincode_channel::ReliableBincodeChannel
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).
Implementations
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]
&'_ mut self,
msg: &'_ T
) -> Result<(), Error>
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
impl !RefUnwindSafe for ReliableBincodeChannel
impl Send for ReliableBincodeChannel
impl Sync for ReliableBincodeChannel
impl Unpin for ReliableBincodeChannel
impl !UnwindSafe for ReliableBincodeChannel
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>,