pub struct ProgramState<'a> {
pub bytecode: [&'a [u8]; 3],
pub initial: Program,
pub current: Program,
pub decoder: Decoder<'a>,
pub call_stack: CallStack,
}
Expand description
State for managing active programs and decoding instructions.
Fields§
§bytecode: [&'a [u8]; 3]
Bytecode for each of the three program types, indexed by Program
.
initial: Program
The initial program when execution begins.
current: Program
The currently active program.
decoder: Decoder<'a>
Instruction decoder for the currently active program.
call_stack: CallStack
Tracks nested function and instruction invocations.
Implementations§
Source§impl<'a> ProgramState<'a>
impl<'a> ProgramState<'a>
pub fn new( font_code: &'a [u8], cv_code: &'a [u8], glyph_code: &'a [u8], initial_program: Program, ) -> Self
Sourcepub fn enter(
&mut self,
definition: Definition,
count: u32,
) -> Result<(), HintErrorKind>
pub fn enter( &mut self, definition: Definition, count: u32, ) -> Result<(), HintErrorKind>
Jumps to the code in the given definition and sets it up for
execution count
times.
Sourcepub fn leave(&mut self) -> Result<(), HintErrorKind>
pub fn leave(&mut self) -> Result<(), HintErrorKind>
Leaves the code from the definition on the top of the stack.
If the top call record has a loop count greater than 1, restarts execution from the beginning of the definition. Otherwise, resumes execution at the previously active definition.
Auto Trait Implementations§
impl<'a> Freeze for ProgramState<'a>
impl<'a> RefUnwindSafe for ProgramState<'a>
impl<'a> Send for ProgramState<'a>
impl<'a> Sync for ProgramState<'a>
impl<'a> Unpin for ProgramState<'a>
impl<'a> UnwindSafe for ProgramState<'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