[][src]Function prost::decode_length_delimiter

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

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.