pub trait Encoder {
// Required methods
fn current_chunk(&self) -> &[u8] ⓘ;
fn advance(&mut self) -> bool;
}Expand description
An encoder for a consensus-encodable object.
Required Methods§
Sourcefn current_chunk(&self) -> &[u8] ⓘ
fn current_chunk(&self) -> &[u8] ⓘ
Yields the current encoded byteslice.
Will always return the same value until Self::advance is called. May return an empty
list.
Sourcefn advance(&mut self) -> bool
fn advance(&mut self) -> bool
Moves the encoder to its next state.
Does not need to be called when the encoder is first created. (In fact, if it is called, this will discard the first chunk of encoded data.)
§Returns
trueif the encoder has advanced to a new state andSelf::current_chunkwill return new data.falseif the encoder is exhausted and has no more states.