Function rscache::parse::rs_string [−][src]
Expand description
Reads a 0-terminated string from the given buffer. Uses String::from_utf8_lossy()
for the conversion.
Errors
Parser can reach EOF early if not enough bytes are supplied or no 0-termination character is present.
Example
use rscache::parse::rs_string;
let buffer = &[82, 117, 110, 105, 116, 101, 32, 98, 97, 114, 0, 52, 14, 85, 65, 4, 56];
let (buffer, string) = rs_string(buffer)?;
assert_eq!(&string, "Runite bar");
assert_eq!(buffer, &[52, 14, 85, 65, 4, 56]);