pub struct Deserializer<'a> {
pub context: ProtocolContext,
pub data: &'a [u8],
}
Fields§
§context: ProtocolContext
§data: &'a [u8]
Implementations§
Source§impl<'a> Deserializer<'a>
impl<'a> Deserializer<'a>
pub fn new(context: ProtocolContext, data: &'a [u8]) -> Self
Sourcepub fn slice(&mut self, count: usize) -> DeserializeResult<Self>
pub fn slice(&mut self, count: usize) -> DeserializeResult<Self>
Take a number of bytes, and return a sub-Deserializer which only operates on those bytes
pub fn context(&self) -> ProtocolContext
pub fn direction(&self) -> CommandDirection
pub fn remaining(&self) -> usize
Sourcepub fn find(&mut self, b: u8) -> Option<usize>
pub fn find(&mut self, b: u8) -> Option<usize>
Finds the first occurance of the byte ‘b’ from the current position in the stream.
pub fn peek(&mut self, count: usize) -> DeserializeResult<&'a [u8]>
pub fn peek_all(&mut self) -> &'a [u8] ⓘ
pub fn take(&mut self, count: usize) -> DeserializeResult<&'a [u8]>
pub fn take_n<const N: usize>(&mut self) -> DeserializeResult<[u8; N]>
pub fn take_all(&mut self) -> &'a [u8] ⓘ
Sourcepub fn peek_line(&mut self) -> DeserializeResult<&'a [u8]>
pub fn peek_line(&mut self) -> DeserializeResult<&'a [u8]>
Peek the next line (including ending \n, if present) If the stream is at end, this will be an empty slice.
Sourcepub fn take_line(&mut self) -> DeserializeResult<&'a [u8]>
pub fn take_line(&mut self) -> DeserializeResult<&'a [u8]>
Take the next line (including ending \n, if present) If the stream is at end, this will be an empty slice.
Sourcepub fn take_word(&mut self, skip_whitespace: bool) -> &'a [u8] ⓘ
pub fn take_word(&mut self, skip_whitespace: bool) -> &'a [u8] ⓘ
Take bytes until whitespace or end of stream If skip_whitespace is true, skips initial whitespace first. If skip_whitespace is false, and the next byte is a space, nothing is taken, and the returned will be empty.
Sourcepub fn take_space(&mut self)
pub fn take_space(&mut self)
Take whitespace from the current cursor. Repositioning the cursor at the start of the next word (or end of stream)
Auto Trait Implementations§
impl<'a> Freeze for Deserializer<'a>
impl<'a> RefUnwindSafe for Deserializer<'a>
impl<'a> Send for Deserializer<'a>
impl<'a> Sync for Deserializer<'a>
impl<'a> Unpin for Deserializer<'a>
impl<'a> UnwindSafe for Deserializer<'a>
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