/// Returns the next null-terminated string. The null character is not
/// included the returned string. The cursor is advanced past the null-
/// terminated string.
Returns the next null-terminated string. The null character is not
included the returned string. The cursor is advanced past the null
terminated string.
Returns the next null - terminated string . The null character is not included the returned string . The cursor is advanced past the null terminated string .
pub(crate) fn read_cstr(&mut self) -> Result<&'a str> {
        if let Some(pos) = self.buf.iter().position(|b| *b == 0) {
            let val = std::str::from_utf8(&self.buf[..pos]).map_err(|_e| Error::InvalidUtfString)?;
            self.advance(pos + 1);
            Ok(val)
        } else {
            Err(Error::ZeroByteNotFound)
        }
    }
pub ( crate ) fn read_cstr ( & mut self ) -> Result < & ' a str > { if let Some ( pos ) = self . buf . iter ( ) . position ( | b | * b == 0 ) { let val = std :: str :: from_utf8 ( & self . buf [ .. pos ] ) . map_err ( | _e | Error :: InvalidUtfString ) ? ; self . advance ( pos + 1 ) ; Ok ( val ) } else { Err ( Error :: ZeroByteNotFound ) } }
Returns the next null-terminated string.
Returns the next null - terminated string .
&mut self