Skip to main content

decode_string

Function decode_string 

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

Decode a string value: read a varint length prefix, then that many bytes, and validate that the bytes are valid UTF-8.

§Errors

§Panics

If buf.chunk() returns an empty slice before buf.remaining() bytes have been read — a Buf that violates its own contract.