pub struct Strontium {
pub registers: Registers,
pub ip: usize,
pub call_stack: Vec<u8>,
/* private fields */
}
Fields§
§registers: Registers
Holds general-purpose registers for storing different types of values
ip: usize
Points to the next index in the buffer of the bytecode register.
call_stack: Vec<u8>
Contains references for function arguments and return values
Implementations§
source§impl Strontium
impl Strontium
sourcepub fn push_bytecode(&mut self, bytes: Vec<u8>)
pub fn push_bytecode(&mut self, bytes: Vec<u8>)
Append machine code to the array in the bytecode register.
sourcepub fn execute(
&mut self,
instruction: Instruction
) -> Result<bool, StrontiumError>
pub fn execute( &mut self, instruction: Instruction ) -> Result<bool, StrontiumError>
Execute a single instruction.
sourcepub fn consume_u64(&mut self) -> Result<u64, StrontiumError>
pub fn consume_u64(&mut self) -> Result<u64, StrontiumError>
Consume an unsigned 64-bit integer from the bytecode register.
This performs a lookahead on the bytecode register to read the next eight bytes and converts the bytes into a 64-bit integer value. The byte encoding within Strontium bytecode is always Little Endian.
pub fn consume_u32(&mut self) -> Result<u32, StrontiumError>
pub fn consume_u16(&mut self) -> Result<u16, StrontiumError>
pub fn consume_u8(&mut self) -> Result<u8, StrontiumError>
pub fn consume_i64(&mut self) -> Result<i64, StrontiumError>
pub fn consume_i32(&mut self) -> Result<i32, StrontiumError>
pub fn consume_i16(&mut self) -> Result<i16, StrontiumError>
pub fn consume_i8(&mut self) -> Result<i8, StrontiumError>
pub fn consume_f64(&mut self) -> Result<f64, StrontiumError>
pub fn consume_f32(&mut self) -> Result<f32, StrontiumError>
pub fn consume_bool(&mut self) -> Result<bool, StrontiumError>
pub fn consume_byte(&mut self) -> Result<u8, StrontiumError>
pub fn consume_string(&mut self) -> Result<String, StrontiumError>
Auto Trait Implementations§
impl !RefUnwindSafe for Strontium
impl !Send for Strontium
impl !Sync for Strontium
impl Unpin for Strontium
impl !UnwindSafe for Strontium
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