Trait gameshell::IncConsumer
source · pub trait IncConsumer {
// Required methods
fn consume(&mut self, output: &mut [u8]) -> Consumption;
fn validate(&mut self, output: u8) -> Validation;
fn process(&mut self, input: &[u8]) -> Process;
// Provided method
fn run(&mut self, buf: &mut [u8]) { ... }
}
Expand description
Incremental consumer of bytes
Consume bytes until a complete set of bytes has been found, then, run a handler function on just that set of bytes.
This is used for accepting bytes from some external stream, note that we set a maximum size on the buffer, so no external input can cause excessive memory usage.
Required Methods§
sourcefn consume(&mut self, output: &mut [u8]) -> Consumption
fn consume(&mut self, output: &mut [u8]) -> Consumption
Consume bytes and place them on an output stack