Skip to main content

Runner

Struct Runner 

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

REPL runner that manages the line-editor and command registry.

The Runner owns a rustyline::Editor configured with a simple CmdHelper for tab-completion and a Registry of available commands. Construct a Runner with Runner::new() and call run(state) to read a single line of input and dispatch the corresponding command.

Implementations§

Source§

impl Runner

Source

pub fn new() -> Result<Self>

Construct a new REPL Runner with default command registry and line-editing helper.

§Errors

Returns an error if the underlying rustyline::Editor cannot be created.

§Returns

A Result containing the newly created Runner.

Source

pub fn run(&mut self, state: &mut State<'_>) -> Result<()>

Read a single line from the user and dispatch the corresponding command.

§Arguments
  • state - Mutable reference to the runtime State passed to command handlers.
§Errors

Returns an error when readline operations fail or when command dispatching returns an error.

§Returns

Returns the Result returned by the invoked command handler.

Auto Trait Implementations§

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.