Struct runestick::Unit[][src]

pub struct Unit { /* fields omitted */ }

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]

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]

Iterate over all static strings in the unit.

pub fn iter_static_object_keys(
    &self
) -> impl Iterator<Item = (usize, &[String])> + '_
[src]

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.