Skip to main content

Session

Struct Session 

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

Implementations§

Source§

impl Session

Source

pub fn new(executor: Box<dyn Executor>, store: Box<dyn Store>) -> Session

Build a session over an executor and a store, restoring any persisted macro history from the store.

Source

pub fn seed_defs(&mut self, text: &str) -> Result<()>

Seed the macro table from a --defs file (validated first).

Source

pub fn add_def(&mut self, line: &str) -> Result<()>

Add a def/macro line to the table (validated first). Unlike a query line, a definition is not run.

Source

pub fn eval(&self, line: &str) -> Result<Vec<Cell>>

Evaluate a line against the standing arbor (&N). Pure — history is not touched (a failed line commits nothing).

Source

pub fn eval_fresh(&self, line: &str) -> Result<Vec<Cell>>

Evaluate a line against a freshly re-materialized source — the &N! live reading, which sees current data.

Source

pub fn commit(&mut self, line: &str, snapshot: Vec<Cell>) -> bool

Register an accepted line as &N and capture its output as the frozen footprint for &N#. Returns whether the line’s shape could be a macro body (so &N will resolve); either way the line number advances so labels track what the user saw.

Source

pub fn frozen(&self, n: usize) -> Option<&Vec<Cell>>

The frozen output of line n, if captured — what a &N# recall replays.

Source

pub fn record_frozen(&mut self, snapshot: Vec<Cell>)

Record a frozen-recall line: it takes the next number and keeps its own snapshot, but is not itself a referenceable macro body.

Source

pub fn line_no(&self) -> usize

The &N a fresh line will claim.

Source

pub fn history(&self) -> &str

The macro history text, for a :history command.

Source

pub fn restore(&mut self, defs_text: String, line_no: usize)

Replace the macro history and line counter — restoring a persisted session (e.g. from the browser’s localStorage). Frozen snapshots are not restored; they regenerate on re-run.

Source

pub fn reset(&mut self)

Clear the macro history and restart line numbering.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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