pub enum MemoryAddress {
    Direct(usize),
    Relative(usize),
}Expand description
Represents an address in the VM’s memory. Supports both direct and relative addressing.
Variants§
Direct(usize)
Specifies an exact index in the VM’s memory.
Relative(usize)
Specifies an index relative to the stack pointer.
It is resolved as the current stack pointer plus the offset stored here.
The current stack pointer is wherever slot 0 of the Memory points at.
Implementations§
Source§impl MemoryAddress
 
impl MemoryAddress
Sourcepub fn unwrap_direct(self) -> usize
 
pub fn unwrap_direct(self) -> usize
Return the index in a Direct address.
Panics if it’s Relative.
Sourcepub fn unwrap_relative(self) -> usize
 
pub fn unwrap_relative(self) -> usize
Return the index in a Relative address.
Panics if it’s Direct.
pub fn is_relative(&self) -> bool
pub fn is_direct(&self) -> bool
Trait Implementations§
Source§impl Clone for MemoryAddress
 
impl Clone for MemoryAddress
Source§fn clone(&self) -> MemoryAddress
 
fn clone(&self) -> MemoryAddress
Returns a copy 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 MemoryAddress
 
impl Debug for MemoryAddress
Source§impl<'de> Deserialize<'de> for MemoryAddress
 
impl<'de> Deserialize<'de> for MemoryAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MemoryAddress
 
impl Display for MemoryAddress
Source§impl Hash for MemoryAddress
 
impl Hash for MemoryAddress
Source§impl Ord for MemoryAddress
 
impl Ord for MemoryAddress
Source§fn cmp(&self, other: &MemoryAddress) -> Ordering
 
fn cmp(&self, other: &MemoryAddress) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MemoryAddress
 
impl PartialEq for MemoryAddress
Source§impl PartialOrd for MemoryAddress
 
impl PartialOrd for MemoryAddress
Source§impl Serialize for MemoryAddress
 
impl Serialize for MemoryAddress
impl Copy for MemoryAddress
impl Eq for MemoryAddress
impl StructuralPartialEq for MemoryAddress
Auto Trait Implementations§
impl Freeze for MemoryAddress
impl RefUnwindSafe for MemoryAddress
impl Send for MemoryAddress
impl Sync for MemoryAddress
impl Unpin for MemoryAddress
impl UnwindSafe for MemoryAddress
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<Q, K> Comparable<K> for Q
 
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to 
key and return true if they are equal.Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more