pub fn encode_string<B: BufMut>(buf: &mut B, string: &str) -> Result<()>Expand description
Encodes 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::create(string)?.to_be_bytes() for new code.
ยงErrors
Returns an error if:
- The string contains null characters
- The string length exceeds maximum string length