Skip to main content

SourceSession

Struct SourceSession 

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

Implementations§

Source§

impl SourceSession

Source

pub fn prepare(&self, source: &str) -> Result<CheckedSubmission, Diagnostic>

Source

pub fn prepare_replace( &self, source: &str, ) -> Result<CheckedSubmission, Diagnostic>

Prepare a submission that explicitly replaces matching top-level declarations using projectional::Edit::ReplaceItem with full rollback on failure.

Source

pub fn prepare_edit(&self, edit: &Edit) -> Result<CheckedSubmission, Diagnostic>

Prepare an incremental projectional::Edit against the retained session program. Returns an error without mutating session state if bounds, limits, or checks fail.

Source§

impl SourceSession

Source

pub fn new(grants: Vec<String>, limits: SessionLimits) -> Self

Source

pub fn revision(&self) -> u64

Source

pub fn bindings(&self) -> SessionBindings<'_>

Read-only accepted bindings, using the same view as tentative validation.

Source

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

Source

pub fn is_mutable(&self, name: &str) -> bool

Source

pub fn sources(&self) -> &[String]

Source

pub fn binding_type(&self, name: &str) -> Option<String>

Source

pub fn submit<H: Host>( &mut self, source: &str, host: &mut H, budget: Budget, ) -> Result<SubmissionResult, SubmissionError>

Source

pub fn submit_validated<H: Host, F: FnOnce(&Value) -> Result<(), Diagnostic>>( &mut self, source: &str, host: &mut H, budget: Budget, validate: F, ) -> Result<SubmissionResult, SubmissionError>

Validate evaluated output before promoting any tentative local values, definitions or source. Host effects already attempted are not rolled back.

Source

pub fn submit_validated_bindings<H: Host, F>( &mut self, source: &str, host: &mut H, budget: Budget, validate: F, ) -> Result<SubmissionResult, SubmissionError>

Validate tentative bindings and result using the same host before local promotion. Dispatched host effects are not automatically rolled back.

Source

pub fn execute<H: Host>( &mut self, candidate: CheckedSubmission, host: &mut H, budget: Budget, ) -> Result<SubmissionResult, SubmissionError>

Source

pub fn apply_edit<H: Host>( &mut self, edit: &Edit, host: &mut H, budget: Budget, ) -> Result<SubmissionResult, SubmissionError>

Apply a structural projectional::Edit and re-evaluate the session. Any parse, check, or evaluation failure rolls back all session state.

Source

pub fn replace<H: Host>( &mut self, source: &str, host: &mut H, budget: Budget, ) -> Result<SubmissionResult, SubmissionError>

Submit source with explicit replacement of matching top-level declarations. Any check or evaluation failure rolls back all session state.

Source

pub fn execute_validated<H: Host, F: FnOnce(&Value) -> Result<(), Diagnostic>>( &mut self, candidate: CheckedSubmission, host: &mut H, budget: Budget, validate: F, ) -> Result<SubmissionResult, SubmissionError>

The validator receives actual evaluated output once, after interpreter checks and before promotion. It may recheck native authority while its owner transaction is held; no JSON receipt is treated as authority.

Source

pub fn execute_validated_bindings<H: Host, F>( &mut self, candidate: CheckedSubmission, host: &mut H, budget: Budget, validate: F, ) -> Result<SubmissionResult, SubmissionError>

Inspect tentative bindings and debit the actual host before promotion. A rejected callback preserves local source/session state. Any already dispatched external host effects still require reconciliation.

Trait Implementations§

Source§

impl Default for SourceSession

Source§

fn default() -> Self

Returns the “default value” for a type. 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
§

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>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,