pub struct Shell { /* private fields */ }Expand description
Represents the Shell that parses the user input into a command and executes it
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn new(prefix: Option<&str>, available_commands: Vec<Command>) -> Self
pub fn new(prefix: Option<&str>, available_commands: Vec<Command>) -> Self
Creates a new Shell
§Arguments
prefix- The prefix that should be printed before the user inputs a commandavailable_commands- A list of commands that are executable
Sourcepub fn process(&self) -> Result<(), CommandError>
pub fn process(&self) -> Result<(), CommandError>
Processes a whole command
This includes:
- Reading the command with arguments from
STDIN - Execute the command
- Return the result
§Returns
This function returns Ok(()) if everything went fine. Otherwise it
will return a CommandError which represents the error hat occured
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more