Struct runestick::Unit [−][src]
Instructions from a single source file.
Implementations
impl Unit
[src]
pub fn new(
instructions: Vec<Inst>,
functions: HashMap<Hash, UnitFn>,
static_strings: Vec<Arc<StaticString>>,
static_bytes: Vec<Vec<u8>>,
static_object_keys: Vec<Box<[String]>>,
rtti: HashMap<Hash, Arc<Rtti>>,
variant_rtti: HashMap<Hash, Arc<VariantRtti>>,
debug: Option<Box<DebugInfo>>,
constants: HashMap<Hash, ConstValue>
) -> Self
[src]
instructions: Vec<Inst>,
functions: HashMap<Hash, UnitFn>,
static_strings: Vec<Arc<StaticString>>,
static_bytes: Vec<Vec<u8>>,
static_object_keys: Vec<Box<[String]>>,
rtti: HashMap<Hash, Arc<Rtti>>,
variant_rtti: HashMap<Hash, Arc<VariantRtti>>,
debug: Option<Box<DebugInfo>>,
constants: HashMap<Hash, ConstValue>
) -> Self
Construct a new unit with the given content.
pub fn debug_info(&self) -> Option<&DebugInfo>
[src]
Access debug information for the given location if it is available.
pub fn instruction_at(&self, ip: usize) -> Option<&Inst>
[src]
Get the instruction at the given instruction pointer.
pub fn iter_static_strings(
&self
) -> impl Iterator<Item = &Arc<StaticString>> + '_
[src]
&self
) -> impl Iterator<Item = &Arc<StaticString>> + '_
Iterate over all static strings in the unit.
pub fn iter_static_object_keys(
&self
) -> impl Iterator<Item = (usize, &[String])> + '_
[src]
&self
) -> impl Iterator<Item = (usize, &[String])> + '_
Iterate over all static object keys in the unit.
pub fn iter_instructions(&self) -> impl Iterator<Item = Inst> + '_
[src]
Iterate over all instructions in order.
pub fn iter_functions(&self) -> impl Iterator<Item = (Hash, &UnitFn)> + '_
[src]
Iterate over dynamic functions.
pub fn lookup_string(&self, slot: usize) -> Result<&Arc<StaticString>, VmError>
[src]
Lookup the static string by slot, if it exists.
pub fn lookup_bytes(&self, slot: usize) -> Result<&[u8], VmError>
[src]
Lookup the static byte string by slot, if it exists.
pub fn lookup_object_keys(&self, slot: usize) -> Option<&[String]>
[src]
Lookup the static object keys by slot, if it exists.
pub fn lookup_rtti(&self, hash: Hash) -> Option<&Arc<Rtti>>
[src]
Lookup runt-time information for the given type hash.
pub fn lookup_variant_rtti(&self, hash: Hash) -> Option<&Arc<VariantRtti>>
[src]
Lookup variant runt-time information for the given variant hash.
pub fn lookup(&self, hash: Hash) -> Option<UnitFn>
[src]
Lookup information of a function.
pub fn constant(&self, hash: Hash) -> Option<&ConstValue>
[src]
Read a constant value from the unit.
Trait Implementations
impl Debug for Unit
[src]
impl Default for Unit
[src]
impl<'de> Deserialize<'de> for Unit
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Unit
[src]
Auto Trait Implementations
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,