Skip to main content

ReplSession

Struct ReplSession 

Source
pub struct ReplSession<'i, H> { /* private fields */ }
Expand description

A persistent REPL session against an Interpreter<H>.

Multiple calls to eval_str share the same global env — bindings introduced by one call are visible to subsequent calls. Errors in one call do not poison the session.

Implementations§

Source§

impl<'i, H: 'static> ReplSession<'i, H>

Source

pub fn new(interp: &'i mut Interpreter<H>) -> Self

Source

pub fn eval_str(&mut self, input: &str, host: &mut H) -> Result<Value>

Evaluate one or more forms from input in the session’s env, returning the value of the last form. Phase 2.5 fills this in.

Source

pub fn is_complete(input: &str) -> bool

Paren-balance check — returns true when input is a complete set of top-level forms (ready to submit) or false when the user’s client should keep collecting more input.

Phase 2.2: minimal heuristic (open-paren count vs close-paren count, ignoring string literals). Phase 2.5 refines.

Auto Trait Implementations§

§

impl<'i, H> !RefUnwindSafe for ReplSession<'i, H>

§

impl<'i, H> !UnwindSafe for ReplSession<'i, H>

§

impl<'i, H> Freeze for ReplSession<'i, H>

§

impl<'i, H> Send for ReplSession<'i, H>

§

impl<'i, H> Sync for ReplSession<'i, H>

§

impl<'i, H> Unpin for ReplSession<'i, H>

§

impl<'i, H> UnsafeUnpin for ReplSession<'i, 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
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, 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.