Skip to main content

EmbeddedProgram

Struct EmbeddedProgram 

Source
pub struct EmbeddedProgram { /* private fields */ }

Implementations§

Source§

impl EmbeddedProgram

Source

pub fn builder() -> EmbeddedBuilder

Source

pub fn vm_mut(&mut self) -> &mut VM

Source

pub fn set_gas_budget(&mut self, limit: u64)

Source

pub fn clear_gas_budget(&mut self)

Source

pub fn reset_gas_counter(&mut self)

Source

pub fn gas_used(&self) -> u64

Source

pub fn gas_remaining(&self) -> Option<u64>

Source

pub fn set_memory_budget_bytes(&mut self, limit_bytes: usize)

Source

pub fn set_memory_budget_kb(&mut self, limit_kb: u64)

Source

pub fn clear_memory_budget(&mut self)

Source

pub fn reset_memory_counter(&mut self)

Source

pub fn memory_used_bytes(&self) -> usize

Source

pub fn memory_remaining_bytes(&self) -> Option<usize>

Source

pub fn dump_externs_to_dir( &self, output_root: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>

Source

pub fn global_names(&self) -> Vec<String>

Source

pub fn globals(&self) -> Vec<(String, Value)>

Source

pub fn signature(&self, function_name: &str) -> Option<&FunctionSignature>

Source

pub fn typed_functions( &self, ) -> impl Iterator<Item = (&String, &FunctionSignature)>

Source

pub fn struct_definition(&self, type_name: &str) -> Option<&StructDef>

Source

pub fn enum_definition(&self, type_name: &str) -> Option<&EnumDef>

Source

pub fn get_global_value(&self, name: &str) -> Option<Value>

Source

pub fn get_typed_global<T: FromLustValue>( &self, name: &str, ) -> Result<Option<T>>

Source

pub fn set_global_value<V: IntoTypedValue>( &mut self, name: impl Into<String>, value: V, )

Source

pub fn struct_instance<I>( &self, type_name: impl Into<String>, fields: I, ) -> Result<StructInstance>

Source

pub fn enum_variant( &self, type_name: impl Into<String>, variant: impl Into<String>, ) -> Result<EnumInstance>

Source

pub fn enum_variant_with<I, V>( &self, type_name: impl Into<String>, variant: impl Into<String>, payload: I, ) -> Result<EnumInstance>
where I: IntoIterator<Item = V>, V: IntoTypedValue,

Source

pub fn register_native_fn<F>(&mut self, name: impl Into<String>, func: F)
where F: Fn(&[Value]) -> Result<NativeCallResult, String> + 'static,

Source

pub fn register_async_native<F, Fut>( &mut self, name: impl Into<String>, func: F, ) -> Result<()>
where F: Fn(Vec<Value>) -> Fut + 'static, Fut: Future<Output = Result<Value, String>> + 'static,

Source

pub fn register_typed_native<Args, R, F>( &mut self, name: &str, func: F, ) -> Result<()>
where Args: FromLustArgs, R: IntoLustValue + FromLustValue, F: Fn(Args) -> Result<R, String> + 'static,

Source

pub fn register_async_typed_native<Args, R, F, Fut>( &mut self, name: &str, func: F, ) -> Result<()>
where Args: FromLustArgs, R: IntoLustValue + FromLustValue, F: Fn(Args) -> Fut + 'static, Fut: Future<Output = Result<R, String>> + 'static,

Source

pub fn register_async_task_native<Args, R, F, Fut>( &mut self, name: &str, func: F, ) -> Result<()>
where Args: FromLustArgs, R: IntoLustValue + FromLustValue, F: Fn(Args) -> Fut + 'static, Fut: Future<Output = Result<R, String>> + 'static,

Source

pub fn register_async_task_queue<Args, R>( &mut self, name: &str, queue: AsyncTaskQueue<Args, R>, ) -> Result<()>
where Args: FromLustArgs + 'static, R: IntoLustValue + FromLustValue + 'static,

Source

pub fn call_typed<Args, R>( &mut self, function_name: &str, args: Args, ) -> Result<R>
where Args: FunctionArgs, R: FromLustValue,

Source

pub fn call_raw( &mut self, function_name: &str, args: Vec<Value>, ) -> Result<Value>

Source

pub fn function_handle(&self, function_name: &str) -> Result<FunctionHandle>

Source

pub fn run_entry_script(&mut self) -> Result<()>

Source

pub fn poll_async_tasks(&mut self) -> Result<()>

Source

pub fn has_pending_async_tasks(&self) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V