[−][src]Struct runestick::unit::Unit
Instructions from a single source file.
Implementations
impl Unit
[src]
pub fn new() -> Self
[src]
Construct a new unit.
pub fn with_default_prelude() -> Self
[src]
Construct a new unit with the default prelude.
pub fn lookup_meta(&self, name: &Item) -> Option<Meta>
[src]
Access the meta for the given language item.
pub fn lookup_type(&self, hash: Hash) -> Option<&UnitTypeInfo>
[src]
Access the type for the given language item.
pub fn function_at(&self, n: usize) -> Option<(Hash, &UnitFnInfo)>
[src]
Access the function at the given instruction location.
pub fn debug_info_at(&self, n: usize) -> 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 = (Hash, &str)> + '_
[src]
Iterate over all static strings in the unit.
pub fn iter_static_object_keys(
&self
) -> impl Iterator<Item = (Hash, &[String])> + '_
[src]
&self
) -> impl Iterator<Item = (Hash, &[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, &Arc<UnitFnInfo>)> + '_
[src]
&self
) -> impl Iterator<Item = (Hash, &Arc<UnitFnInfo>)> + '_
Iterate over known functions.
pub fn iter_imports<'a>(
&'a self
) -> impl Iterator<Item = (&'a Component, &'a Item)> + '_
[src]
&'a self
) -> impl Iterator<Item = (&'a Component, &'a Item)> + '_
Iterate over known imports.
pub fn lookup_string(&self, slot: usize) -> Result<&Arc<String>, 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 new_static_string(&mut self, current: &str) -> Result<usize, UnitError>
[src]
Insert a static string and return its associated slot that can later be looked up through lookup_string.
Only uses up space if the static string is unique.
pub fn new_static_bytes(&mut self, current: &[u8]) -> Result<usize, UnitError>
[src]
Insert a static byte string and return its associated slot that can later be looked up through lookup_bytes.
Only uses up space if the static byte string is unique.
pub fn new_static_object_keys(
&mut self,
current: &[String]
) -> Result<usize, UnitError>
[src]
&mut self,
current: &[String]
) -> Result<usize, UnitError>
Insert a new collection of static object keys, or return one already existing.
pub fn lookup(&self, hash: Hash) -> Option<&Arc<UnitFnInfo>>
[src]
Lookup information of a function.
pub fn lookup_import_by_name(
&self,
item: &Item,
name: &Component
) -> Option<&Item>
[src]
&self,
item: &Item,
name: &Component
) -> Option<&Item>
Look up an use by name.
pub fn new_import<I>(&mut self, item: Item, path: I) -> Result<(), UnitError> where
I: Copy + IntoIterator,
I::Item: Into<Component>,
[src]
I: Copy + IntoIterator,
I::Item: Into<Component>,
Declare a new import.
pub fn insert_meta(&mut self, meta: Meta) -> Result<(), UnitError>
[src]
Declare a new struct.
pub fn new_assembly(&self) -> Assembly
[src]
Construct a new empty assembly associated with the current unit.
pub fn new_function(
&mut self,
path: Item,
args: usize,
assembly: Assembly,
call: UnitFnCall
) -> Result<(), UnitError>
[src]
&mut self,
path: Item,
args: usize,
assembly: Assembly,
call: UnitFnCall
) -> Result<(), UnitError>
Declare a new function at the current instruction pointer.
pub fn new_instance_function(
&mut self,
path: Item,
value_type: ValueType,
name: &str,
args: usize,
assembly: Assembly,
call: UnitFnCall
) -> Result<(), UnitError>
[src]
&mut self,
path: Item,
value_type: ValueType,
name: &str,
args: usize,
assembly: Assembly,
call: UnitFnCall
) -> Result<(), UnitError>
Declare a new instance function at the current instruction pointer.
pub fn link(&self, context: &Context, errors: &mut LinkerErrors) -> bool
[src]
Try to link the unit with the context, checking that all necessary functions are provided.
This can prevent a number of runtime errors, like missing functions.
Trait Implementations
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,
fn borrow_mut(&mut self) -> &mut T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,