Skip to main content

RustiaExtension

Struct RustiaExtension 

Source
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

Source

pub fn new(namespace: impl Into<String>) -> Self

Creates callbacks to install under a named table. An empty name selects globals.

Source

pub fn global() -> Self

Creates callbacks to install directly as globals.

Source

pub fn namespace(&self) -> Option<&str>

Returns the table name, or None for global callbacks.

Source

pub fn fuel_policy(&self) -> RustiaHostFuelPolicy

Returns the fuel policy used by these registration helpers.

Source

pub fn functions(&self) -> impl Iterator<Item = RustiaHostFunctionInfo<'_>> + '_

Describes the callbacks before installation.

Source

pub fn fn_pure<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback declared free of external mutable state, at the default fuel cost.

Source

pub fn fn_input<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback declared to read deterministic input, at the default fuel cost.

Source

pub fn fn_slot_read<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback declared to read slot state, at the default fuel cost.

Source

pub fn fn_slot_write<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback declared to write slot effects, at the default fuel cost.

Source

pub fn fn_effect<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback declared to emit deterministic effects, at the default fuel cost.

Source

pub fn fn_external_state<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a callback that reads external mutable state. Deterministic profiles reject it.

Source

pub fn fn_nondeterministic<Func, Args, Return>( self, name: impl Into<String>, function: Func, ) -> Self
where Func: IntoHostFunction<Args, Return>,

Adds a nondeterministic callback. Deterministic profiles reject it.

Source

pub fn fn_with<Func, Args, Return>( self, name: impl Into<String>, fuel_cost: u32, capability: OpCapability, function: Func, ) -> Self
where 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

Source§

fn clone(&self) -> RustiaExtension

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RustiaExtension

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.