Shell

Struct Shell 

Source
pub struct Shell { /* private fields */ }
Expand description

Represents the state of the interactive shell.

This struct holds the rustyline editor instance, the original directory from which the shell was started, the path to the history file, and the path to the connected database.

Implementations§

Source§

impl Shell

Source

pub fn new(db_path: &str) -> Result<Self>

Creates a new Shell instance.

This function initializes the rustyline editor, sets up the command completer, loads the command history, and establishes a Ctrl+C handler.

§Arguments
  • db_path - The path to the database file, which is kept for context.
§Returns

A Result containing the new Shell instance, or an Err if initialization fails.

Source

pub fn run(&mut self) -> ShellAction

Runs the main loop of the shell.

This function displays the prompt, reads user input, and executes the entered commands. It handles both built-in commands and external system commands. The loop continues until the user enters exit or .vrepl.

§Returns

A ShellAction indicating the user’s intent to either exit the application or switch back to the REPL.

Auto Trait Implementations§

§

impl Freeze for Shell

§

impl !RefUnwindSafe for Shell

§

impl Send for Shell

§

impl Sync for Shell

§

impl Unpin for Shell

§

impl !UnwindSafe for Shell

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V