[−][src]Trait gameshell::IncConsumer
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
fn consume(&mut self, output: &mut [u8]) -> Consumption
Consume bytes and place them on an output stack
fn validate(&mut self, output: u8) -> Validation
Validate part of the bytestream, as soon as we return Validation::Ready
, process
will be run on the current accumulated bytes, after which these bytes will be deleted.
fn process(&mut self, input: &[u8]) -> Process
Process do actual stuff with the bytes to affect the system.
The sequence of bytes input here will have been verified by the validate
function.