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
impl PartialParse
sourcepub fn parse_increment(&mut self, input: u8) -> PartialParseOp
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
impl Debug for PartialParse
source§impl Default for PartialParse
impl Default for PartialParse
source§fn default() -> PartialParse
fn default() -> PartialParse
source§impl PartialEq<PartialParse> for PartialParse
impl PartialEq<PartialParse> for PartialParse
source§fn eq(&self, other: &PartialParse) -> bool
fn eq(&self, other: &PartialParse) -> bool
self
and other
values to be equal, and is used
by ==
.