Function read_cstring

Source
pub fn read_cstring(data: &[u8]) -> Result<(String, usize)>
Expand description

Read a null-terminated C string from a byte slice

§Arguments

  • data - Byte slice to read from

§Returns

  • Tuple of (string, bytes_consumed)

§Errors

  • Returns error if no null terminator found or invalid UTF-8