pub struct RustiaExtension { /* private fields */ }Expand description
A group of Rust callbacks installed together, optionally in a named table.
Add it with RustiaBuilder::extension or Rustia::install_extension.
For callbacks that borrow per-invocation host state, use crate::HostModule
instead. The capability labels here describe captured host state; they do
not provide a borrowed host context or make captured mutations transactional.
Implementations§
Source§impl RustiaExtension
impl RustiaExtension
Sourcepub fn new(namespace: impl Into<String>) -> Self
pub fn new(namespace: impl Into<String>) -> Self
Creates callbacks to install under a named table. An empty name selects globals.
Sourcepub fn fuel_policy(&self) -> RustiaHostFuelPolicy
pub fn fuel_policy(&self) -> RustiaHostFuelPolicy
Returns the fuel policy used by these registration helpers.
Sourcepub fn functions(&self) -> impl Iterator<Item = RustiaHostFunctionInfo<'_>> + '_
pub fn functions(&self) -> impl Iterator<Item = RustiaHostFunctionInfo<'_>> + '_
Describes the callbacks before installation.
Sourcepub fn fn_pure<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_pure<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback declared free of external mutable state, at the default fuel cost.
Sourcepub fn fn_input<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_input<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback declared to read deterministic input, at the default fuel cost.
Sourcepub fn fn_slot_read<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_slot_read<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback declared to read slot state, at the default fuel cost.
Sourcepub fn fn_slot_write<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_slot_write<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback declared to write slot effects, at the default fuel cost.
Sourcepub fn fn_effect<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_effect<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback declared to emit deterministic effects, at the default fuel cost.
Sourcepub fn fn_external_state<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_external_state<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback that reads external mutable state. Deterministic profiles reject it.
Sourcepub fn fn_nondeterministic<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_nondeterministic<Func, Args, Return>(
self,
name: impl Into<String>,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a nondeterministic callback. Deterministic profiles reject it.
Sourcepub fn fn_with<Func, Args, Return>(
self,
name: impl Into<String>,
fuel_cost: u32,
capability: OpCapability,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
pub fn fn_with<Func, Args, Return>(
self,
name: impl Into<String>,
fuel_cost: u32,
capability: OpCapability,
function: Func,
) -> Selfwhere
Func: IntoHostFunction<Args, Return>,
Adds a callback with an explicit capability and nonzero fuel cost. Invalid costs and disallowed capabilities are rejected during installation.
Trait Implementations§
Source§impl Clone for RustiaExtension
impl Clone for RustiaExtension
Source§fn clone(&self) -> RustiaExtension
fn clone(&self) -> RustiaExtension
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more