Function alkahest::write_packet

source ·
pub fn write_packet<F, T, B>(
    value: T,
    output: &mut [u8]
) -> Result<usize, BufferExhausted>where
    F: Formula + ?Sized,
    T: Serialize<F>,
Expand description

Writes packet with the value into bytes slice. Returns the number of bytes written. Fails if the buffer is too small.

To retrieve the number of bytes required to serialize the value, use [serialized_size] or [serialize_or_size].

Errors

Returns BufferExhausted if the buffer is too small.