Skip to main content

Shell

Struct Shell 

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

A running shell.

Implementations§

Source§

impl Shell

Source

pub fn new( options: &Options, database: Database, out: Box<dyn Write>, err: Box<dyn Write>, ) -> Self

A shell over database, writing results to out and errors to err.

Source

pub fn failed(&self) -> bool

Whether anything has failed since the shell started, which is what the exit code is.

Source

pub fn run_commands(&mut self, commands: &[Command]) -> Stop

Runs everything the command line asked for, in order.

Source

pub fn run_file(&mut self, path: &Path) -> Stop

Runs a file of SQL and dot commands.

Source

pub fn greet(&mut self)

The two lines a terminal gets before the first prompt.

Source

pub fn prompt(&mut self, stdin: &Stdin) -> Stop

Reads and runs lines from a terminal until the user stops.

The continuation marker is what says the statement is not finished, and it is the reason rudb::is_complete exists rather than the shell guessing from a trailing semicolon.

Source

pub fn run_input(&mut self, text: &str) -> Stop

Runs a block of input, which may hold any mixture of dot commands and statements.

Line oriented rather than statement oriented, because a dot command is a line and SQL is not. Lines accumulate into a statement until the tokenizer says the statement is finished, which is how a multi line CREATE TABLE works at a prompt and in a file alike.

Trait Implementations§

Source§

impl Debug for Shell

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Shell

§

impl !Send for Shell

§

impl !Sync for Shell

§

impl !UnwindSafe for Shell

§

impl Freeze for Shell

§

impl Unpin for Shell

§

impl UnsafeUnpin 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 = !

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.