Function prost::decode_length_delimiter

source ·
pub fn decode_length_delimiter<B>(buf: B) -> Result<usize, DecodeError>
where B: Buf,
Expand description

Decodes a length delimiter from the buffer.

This method allows the length delimiter to be decoded independently of the message, when the message is encoded with [Message.encode_length_delimited].

An error may be returned in two cases:

  • If the supplied buffer contains fewer than 10 bytes, then an error indicates that more input is required to decode the full delimiter.
  • If the supplied buffer contains more than 10 bytes, then the buffer contains an invalid delimiter, and typically the buffer should be considered corrupt.