Struct gameshell::PartialParse

source ·
pub struct PartialParse { /* private fields */ }
Expand description

A partial parse is a parse where we send single bytes into the parser and get back a complete parsing state. This is useful when reading TCP streams or other streams that may yield at any point in time.

This structure does not in any way do any interpreting or evaluate, it’s just used for stream parsing. This structure is quite low-level. See the tests in this file to see how it operates, based on that, you need to add surrounding facilities where you use this struct to handle the outputs it gives you.

Implementations§

source§

impl PartialParse

source

pub fn parse_increment(&mut self, input: u8) -> PartialParseOp

Parses. 1 byte at a time

This function assumes that a linear stream of bytes is fed into it.

It will return PartialParseOp::Discard when there has been an error. In such cases, all previous bytes ought to be discarded and not interpreted.

When it returns PartialParseOp::Ready, it means that the previous bytes (except for those that were marked PartialParseOp::Discard) can be sent into interpret_single safely.

When it returns PartialParseOp::Unready, it means that the parser simply noticed the character and advanced its internal state.

Trait Implementations§

source§

impl Debug for PartialParse

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for PartialParse

source§

fn default() -> PartialParse

Returns the “default value” for a type. Read more
source§

impl PartialEq<PartialParse> for PartialParse

source§

fn eq(&self, other: &PartialParse) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for PartialParse

Auto Trait Implementations§

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.