Skip to main content

get_string_borrowed

Function get_string_borrowed 

Source
pub fn get_string_borrowed<'de>(
    buf: &mut &'de [u8],
) -> Result<&'de str, ProtocolError>
Expand description

Decode a non-flexible STRING that borrows from the input buffer.

The wire format is an INT16 length of 0 or more, then length UTF-8 bytes. A length of −1 means null, which is an error here.

§Errors

Returns the underlying protocol error when input is truncated, contains an invalid length or tag, or cannot be encoded for the selected version.

§Panics

Panics if a value previously validated by the protocol type no longer satisfies its encoded-length or field-range invariant.