Skip to main content

Engine

Struct Engine 

Source
pub struct Engine<'a, H: Host> { /* private fields */ }

Implementations§

Source§

impl<'a, H: Host> Engine<'a, H>

Source

pub fn eval_program( &mut self, program: &Program, env: &mut Env, ) -> Result<Value, Diagnostic>

Evaluates a program.

Source

pub fn call_function( &mut self, program: &Program, name: &str, args: Vec<Value>, env: &mut Env, ) -> Result<Value, Diagnostic>

Calls a function.

Source

pub fn call_hook( &mut self, program: &Program, path: &[String], args: Vec<Value>, env: &mut Env, ) -> Result<Value, Diagnostic>

Dispatch a hook by event path (e.g. ["pulse", "message"] or ["tick"]).

Finds the first on <path>(…) hook in the program whose path matches, binds the supplied argument values to its parameters, and evaluates its body. Returns Ok(Value::Null) if no matching hook exists (the host may choose to ignore unhandled events silently).

Source§

impl<'a, H: Host> Engine<'a, H>

Source

pub fn eval_expr( &mut self, expr: &Expr, env: &mut Env, ) -> Result<Value, Diagnostic>

Evaluate once; the source-session profile supplies a total expression depth bound so independent call/path limits cannot multiply unchecked.

Source§

impl<'a, H: Host> Engine<'a, H>

Source

pub fn workspace_left(&self) -> u64

Workspace remaining.

Source

pub fn new(host: &'a mut H, budget: Budget) -> Self

Creates a new Engine with all built-in vibe-0.03 extension providers registered.

Source

pub fn with_program(host: &'a mut H, budget: Budget, program: &Program) -> Self

Attach a program so eval_call can resolve user-defined functions.

Source

pub fn with_phase_leaser( host: &'a mut H, budget: Budget, leaser: &'a mut PhaseLeaser, ) -> Self

Attach a deontic phase leaser (R2).

Source

pub fn with_extension_governance( host: &'a mut H, budget: Budget, registry: ExtensionRegistry<'a>, call_context: CallExecutionContext, gate: Option<&'a mut dyn SentinelPolicyGate>, ) -> Self

Attach an explicit ExtensionRegistry, CallExecutionContext, and optional SentinelPolicyGate (Stage S6).

Source

pub fn extension_registry(&self) -> &ExtensionRegistry<'a>

Returns a reference to the engine’s ExtensionRegistry.

Source

pub fn extension_registry_mut(&mut self) -> &mut ExtensionRegistry<'a>

Returns a mutable reference to the engine’s ExtensionRegistry.

Source

pub fn set_extension_governance( &mut self, call_context: CallExecutionContext, gate: Option<&'a mut dyn SentinelPolicyGate>, )

Configures the CallExecutionContext and optional SentinelPolicyGate.

Source

pub fn last_extension_outcome(&self) -> Option<&DispatchOutcome>

Returns the most recent extension DispatchOutcome (receipt and audit NQuin48s).

Source

pub fn active_policy_generation(&self) -> Result<u64, VibeTrap>

Returns the active Sentinel policy generation (or 0 when in standalone developer mode).

Auto Trait Implementations§

§

impl<'a, H> !RefUnwindSafe for Engine<'a, H>

§

impl<'a, H> !Send for Engine<'a, H>

§

impl<'a, H> !Sync for Engine<'a, H>

§

impl<'a, H> !UnwindSafe for Engine<'a, H>

§

impl<'a, H> Freeze for Engine<'a, H>

§

impl<'a, H> Unpin for Engine<'a, H>

§

impl<'a, H> UnsafeUnpin for Engine<'a, H>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>