[−][src]Struct runestick::Context
Static run context visible to the virtual machine.
This contains:
- Declared functions.
- Declared instance functions.
- Type definitions.
Implementations
impl Context
[src]
pub fn new() -> Self
[src]
Construct a new empty collection of functions.
pub fn with_config(stdio: bool) -> Result<Self, ContextError>
[src]
Construct a default set of modules with the given configuration.
stdio
determines if we include I/O functions that interact with stdout and stderr by default, likedbg
,print
, andprintln
.
pub fn runtime(&self) -> RuntimeContext
[src]
Construct a runtime context used when executing the virtual machine.
use runestick::{Context, Vm, Unit}; use std::sync::Arc; let context = Context::with_default_modules()?; let runtime = Arc::new(context.runtime()); let unit = Arc::new(Unit::default()); let vm = Vm::new(runtime, unit);
pub fn type_check_for(&self, item: &Item) -> Option<TypeCheck>
[src]
Use the specified type check.
pub fn with_default_modules() -> Result<Self, ContextError>
[src]
Construct a new collection of functions with default packages installed.
pub fn contains_crate(&self, name: &str) -> bool
[src]
Check if context contains the given crate.
pub fn has_default_modules(&self) -> bool
[src]
Test if the context has the default modules installed.
This determines among other things whether a prelude should be used or not.
pub fn iter_components<'a, I: 'a>(
&'a self,
iter: I
) -> impl Iterator<Item = ComponentRef<'a>> + 'a where
I: IntoIterator,
I::Item: IntoComponent,
[src]
&'a self,
iter: I
) -> impl Iterator<Item = ComponentRef<'a>> + 'a where
I: IntoIterator,
I::Item: IntoComponent,
Iterate over known child components of the given name.
pub fn unit_type(&self) -> Option<Hash>
[src]
Access the currently known unit type.
pub fn contains_name(&self, item: &Item) -> bool
[src]
Check if unit contains the given name.
pub fn contains_prefix(&self, item: &Item) -> bool
[src]
Check if unit contains the given name by prefix.
pub fn lookup(
&self,
hash: Hash
) -> Option<&Arc<dyn Fn(&mut Stack, usize) -> Result<(), VmError> + Send + Sync>>
[src]
&self,
hash: Hash
) -> Option<&Arc<dyn Fn(&mut Stack, usize) -> Result<(), VmError> + Send + Sync>>
Lookup the given native function handler in the context.
pub fn lookup_macro(
&self,
hash: Hash
) -> Option<&Arc<dyn Fn(&dyn Any) -> Result<Box<dyn Any>, Error> + Send + Sync>>
[src]
&self,
hash: Hash
) -> Option<&Arc<dyn Fn(&dyn Any) -> Result<Box<dyn Any>, Error> + Send + Sync>>
Lookup the given macro handler.
pub fn lookup_meta(&self, name: &Item) -> Option<CompileMeta>
[src]
Access the meta for the given language item.
pub fn iter_functions(&self) -> impl Iterator<Item = (Hash, &ContextSignature)>
[src]
Iterate over all available functions
pub fn iter_types(&self) -> impl Iterator<Item = (Hash, &ContextTypeInfo)>
[src]
Iterate over all available types.
pub fn install(&mut self, module: &Module) -> Result<(), ContextError>
[src]
Install the specified module.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
[src]
impl Send for Context
[src]
impl Sync for Context
[src]
impl Unpin for Context
[src]
impl !UnwindSafe for Context
[src]
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> 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>,