Skip to main content

Repl

Struct Repl 

Source
pub struct Repl {
    pub env: Env,
    pub transcript: Vec<String>,
    /* private fields */
}
Expand description

REPL state. Owns the persistent Env and the running transcript so :save can replay the session.

Fields§

§env: Env§transcript: Vec<String>

Implementations§

Source§

impl Repl

Source

pub fn new(env_options: EnvOptions, cwd: Option<PathBuf>) -> Self

Source

pub fn reset(&mut self)

Reset the env to a fresh copy of the original options and clear the transcript.

Source

pub fn evaluate_source( &mut self, source: &str, file: Option<&str>, ) -> (String, String)

Evaluate a chunk of LiNo source against the persistent env.

Source

pub fn feed(&mut self, line: &str) -> ReplStep

Process a single REPL line (LiNo form or meta-command).

Source

pub fn completion_candidates(&self, prefix: &str) -> Vec<String>

Best-effort tab-completion candidates for prefix. Returns names from the env (terms, ops, symbols, lambdas), built-in keywords, and meta-commands when prefix starts with :.

Auto Trait Implementations§

§

impl Freeze for Repl

§

impl RefUnwindSafe for Repl

§

impl Send for Repl

§

impl Sync for Repl

§

impl Unpin for Repl

§

impl UnsafeUnpin for Repl

§

impl UnwindSafe for Repl

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.