pub struct InstructionDecoder { /* private fields */ }Expand description
Represents an instruction decoder that maintains a state.
Its main use case is to decode instructions progressively
byte by byte, when a data source cannot implement Read.
Implementations§
Source§impl InstructionDecoder
impl InstructionDecoder
Sourcepub fn try_decode(&mut self) -> Result<Instruction, DecodingState>
pub fn try_decode(&mut self) -> Result<Instruction, DecodingState>
Attempts to decode one instruction from the decoder’s source.
If there is not enough data to complete the decoding process,
an Err<DecodingState> is returned, which describes the state
of the decoder prior to running out of data.
If an instruction is successfully decoded, an Ok<Instruction>
is returned, and its bytes are drained from the source.
Sourcepub fn push_slice(&mut self, slice: &[u8])
pub fn push_slice(&mut self, slice: &[u8])
Pushes a slice of opcode bytes to the decoder source.
Trait Implementations§
Source§impl Clone for InstructionDecoder
impl Clone for InstructionDecoder
Source§fn clone(&self) -> InstructionDecoder
fn clone(&self) -> InstructionDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InstructionDecoder
impl Debug for InstructionDecoder
Source§impl Default for InstructionDecoder
impl Default for InstructionDecoder
Source§fn default() -> InstructionDecoder
fn default() -> InstructionDecoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InstructionDecoder
impl RefUnwindSafe for InstructionDecoder
impl Send for InstructionDecoder
impl Sync for InstructionDecoder
impl Unpin for InstructionDecoder
impl UnwindSafe for InstructionDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more