Trait ByteReadable

Source
pub trait ByteReadable<Ptr> {
    // Required methods
    fn read(&self, ptr: &mut Ptr) -> Option<u8>;
    fn has_next(&self, ptr: &Ptr) -> bool;

    // Provided methods
    fn read_n(&self, ptr: &mut Ptr, n: usize) -> Option<Vec<u8>> { ... }
    fn read_u16(&self, ptr: &mut Ptr) -> Option<u16> { ... }
    fn read_u32(&self, ptr: &mut Ptr) -> Option<u32> { ... }
    fn read_i32(&self, ptr: &mut Ptr) -> Option<i32> { ... }
}
Expand description

Something that is readable with a pointer

Pointer Ptr should contain the current reading position which should be mutated after each read.

Required Methods§

Source

fn read(&self, ptr: &mut Ptr) -> Option<u8>

Source

fn has_next(&self, ptr: &Ptr) -> bool

Provided Methods§

Source

fn read_n(&self, ptr: &mut Ptr, n: usize) -> Option<Vec<u8>>

Source

fn read_u16(&self, ptr: &mut Ptr) -> Option<u16>

Source

fn read_u32(&self, ptr: &mut Ptr) -> Option<u32>

Source

fn read_i32(&self, ptr: &mut Ptr) -> Option<i32>

Implementors§

Source§

impl ByteReadable<RawBytesPointer> for RawBytes

Source§

impl<'a, Constant, Value: Debug> ByteReadable<InstructionPointer> for Machine<'a, Constant, Value>

Source§

impl<Constant> ByteReadable<InstructionPointer> for Code<Constant>