[−][src]Struct shrust::Shell
A shell
Methods
impl<T> Shell<T>
[src]
pub fn new(data: T) -> Shell<T>
[src]
Create a new shell, wrapping data
, using provided IO
pub fn data(&mut self) -> &mut T
[src]
Get a mutable pointer to the inner data
pub fn set_prompt(&mut self, prompt: String)
[src]
Change the current prompt
pub fn set_unclosed_prompt(&mut self, prompt: String)
[src]
Change the current unclosed prompt
pub fn set_default<F>(&mut self, func: F) where
F: Fn(&mut ShellIO, &mut Shell<T>, &str) -> ExecResult + Send + Sync + 'static,
[src]
F: Fn(&mut ShellIO, &mut Shell<T>, &str) -> ExecResult + Send + Sync + 'static,
pub fn new_shell_command<S, F>(
&mut self,
name: S,
description: S,
nargs: usize,
func: F
) where
S: ToString,
F: Fn(&mut ShellIO, &mut Shell<T>, &[&str]) -> ExecResult + Send + Sync + 'static,
[src]
&mut self,
name: S,
description: S,
nargs: usize,
func: F
) where
S: ToString,
F: Fn(&mut ShellIO, &mut Shell<T>, &[&str]) -> ExecResult + Send + Sync + 'static,
Register a shell command. Shell commands get called with a reference to the current shell
pub fn new_command<S, F>(
&mut self,
name: S,
description: S,
nargs: usize,
func: F
) where
S: ToString,
F: Fn(&mut ShellIO, &mut T, &[&str]) -> ExecResult + Send + Sync + 'static,
[src]
&mut self,
name: S,
description: S,
nargs: usize,
func: F
) where
S: ToString,
F: Fn(&mut ShellIO, &mut T, &[&str]) -> ExecResult + Send + Sync + 'static,
Register a command
pub fn new_command_noargs<S, F>(&mut self, name: S, description: S, func: F) where
S: ToString,
F: Fn(&mut ShellIO, &mut T) -> ExecResult + Send + Sync + 'static,
[src]
S: ToString,
F: Fn(&mut ShellIO, &mut T) -> ExecResult + Send + Sync + 'static,
Register a command that do not accept any argument
pub fn print_help(&self, io: &mut ShellIO) -> ExecResult
[src]
Print the help to stdout
pub fn get_history(&self) -> &History
[src]
Return the command history
pub fn eval(&mut self, io: &mut ShellIO, line: &str) -> ExecResult
[src]
Evaluate a command line
pub fn run_loop(&mut self, io: &mut ShellIO)
[src]
Enter the shell main loop, exiting only when the "quit" command is called
Trait Implementations
impl<T> Clone for Shell<T> where
T: Clone,
[src]
T: Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> DerefMut for Shell<T>
[src]
impl<T> Deref for Shell<T>
[src]
Auto Trait Implementations
impl<T> Send for Shell<T> where
T: Send,
T: Send,
impl<T> Unpin for Shell<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for Shell<T> where
T: Sync,
T: Sync,
impl<T> !RefUnwindSafe for Shell<T>
impl<T> !UnwindSafe for Shell<T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,