decode_string

Function decode_string 

Source
pub fn decode_string<B: Buf>(buf: &mut B) -> Result<String>
Expand description

Decodes a UTF-8 string with a 2-byte length prefix (compatibility function)

This function provides compatibility with the old string module API. Prefer using MqttString::try_from_be_bytes() for new code.

ยงErrors

Returns an error if:

  • Insufficient bytes in buffer
  • String is not valid UTF-8
  • String contains null characters