pub struct Decoder<'a> {
pub bytecode: &'a [u8],
pub pc: usize,
}
Expand description
Decodes instructions from TrueType bytecode.
Fields§
§bytecode: &'a [u8]
The bytecode for the program.
pc: usize
The “program counter” or current offset into the bytecode.
Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
Sourcepub fn new(bytecode: &'a [u8], pc: usize) -> Self
pub fn new(bytecode: &'a [u8], pc: usize) -> Self
Creates a new decoder for the given bytecode and program counter.
Sourcepub fn decode(&mut self) -> Option<Result<Instruction<'a>, DecodeError>>
pub fn decode(&mut self) -> Option<Result<Instruction<'a>, DecodeError>>
Decodes the next instruction.
Returns None
at the end of the bytecode stream.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'a>
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