Skip to main content

pack_ready

Function pack_ready 

Source
pub fn pack_ready<T: Encode<Packer>>(
    v: T,
    dst: &mut BytesMut,
) -> Result<(), <T::Encoder as Encoder<T>>::Error>
Expand description

Synchronously pack a Encode into a singular byte buffer dst.

All asynchronous values contained in v must be ready, this function returns an error of kind std::io::ErrorKind::WouldBlock if any of them is pending.

Futures are polled exactly once and streams are polled until they are pending or finished, so values backed by Tokio I/O types (e.g. tokio::fs::File) are typically pending and require this function to be called within the context of a Tokio runtime.

If this function returns an error, contents of dst are undefined.