pub struct StreamParser { /* private fields */ }Expand description
A streaming cursor over a byte buffer.
Implementations§
Source§impl StreamParser
impl StreamParser
pub fn new() -> Self
Sourcepub fn read_u8(&mut self) -> ParseResult<u8>
pub fn read_u8(&mut self) -> ParseResult<u8>
Read a single byte.
Sourcepub fn read_u16_le(&mut self) -> ParseResult<u16>
pub fn read_u16_le(&mut self) -> ParseResult<u16>
Read a little-endian u16.
Sourcepub fn read_u32_le(&mut self) -> ParseResult<u32>
pub fn read_u32_le(&mut self) -> ParseResult<u32>
Read a little-endian u32.
Sourcepub fn read_bytes(&mut self, n: usize) -> ParseResult<Vec<u8>>
pub fn read_bytes(&mut self, n: usize) -> ParseResult<Vec<u8>>
Read n raw bytes.
Sourcepub fn read_cstring(&mut self) -> ParseResult<String>
pub fn read_cstring(&mut self) -> ParseResult<String>
Read a null-terminated UTF-8 string.
Sourcepub fn reset_cursor(&mut self)
pub fn reset_cursor(&mut self)
Reset the cursor to the beginning (keeps buffer data).
Sourcepub fn parse_count(&self) -> u64
pub fn parse_count(&self) -> u64
Number of successful parse calls.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamParser
impl RefUnwindSafe for StreamParser
impl Send for StreamParser
impl Sync for StreamParser
impl Unpin for StreamParser
impl UnsafeUnpin for StreamParser
impl UnwindSafe for StreamParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more