pub struct Deserializer<'a> {
    pub context: ProtocolContext,
    pub data: &'a [u8],
}

Fields§

§context: ProtocolContext§data: &'a [u8]

Implementations§

source§

impl<'a> Deserializer<'a>

source

pub fn new(context: ProtocolContext, data: &'a [u8]) -> Self

source

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

source

pub fn context(&self) -> ProtocolContext

source

pub fn direction(&self) -> CommandDirection

source

pub fn remaining(&self) -> usize

source

pub fn find(&mut self, b: u8) -> Option<usize>

Finds the first occurance of the byte ‘b’ from the current position in the stream.

source

pub fn peek(&mut self, count: usize) -> DeserializeResult<&'a [u8]>

source

pub fn peek_all(&mut self) -> &'a [u8]

source

pub fn take(&mut self, count: usize) -> DeserializeResult<&'a [u8]>

source

pub fn take_n<const N: usize>(&mut self) -> DeserializeResult<[u8; N]>

source

pub fn take_all(&mut self) -> &'a [u8]

source

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.

source

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.

source

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.

source

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> 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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V