Shell

Struct Shell 

Source
pub struct Shell<'tree, L, IO, H, C>
where L: AccessLevel, IO: CharIo, H: CommandHandler<C>, C: ShellConfig,
{ /* private fields */ }
Expand description

Shell orchestration struct.

Brings together all components following the unified architecture pattern. Uses single code path for both auth-enabled and auth-disabled modes.

Implementations§

Source§

impl<'tree, L, IO, H, C> Shell<'tree, L, IO, H, C>
where L: AccessLevel, IO: CharIo, H: CommandHandler<C>, C: ShellConfig,

Source

pub fn new(tree: &'tree Directory<L>, handler: H, io: IO) -> Self

Create new Shell

Starts in Inactive state. Call activate() to show welcome message and prompt.

Source§

impl<'tree, L, IO, H, C> Shell<'tree, L, IO, H, C>
where L: AccessLevel, IO: CharIo, H: CommandHandler<C>, C: ShellConfig,

Source

pub fn activate(&mut self) -> Result<(), IO::Error>

Activate the shell (show welcome message and initial prompt).

Transitions from Inactive to appropriate state (LoggedOut or LoggedIn).

Source

pub fn deactivate(&mut self)

Deactivate shell (transition to Inactive). Clears session and resets to root directory.

Source

pub fn process_char(&mut self, c: char) -> Result<(), IO::Error>

Process single character of input (main entry point for char-by-char processing).

Source

pub fn poll(&mut self) -> Result<(), IO::Error>

Poll for incoming characters and process them. For interrupt-driven/DMA/async/RTOS use process_char() directly.

Source

pub fn io(&self) -> &IO

Get reference to I/O interface (for inspection or direct control).

Source

pub fn io_mut(&mut self) -> &mut IO

Get mutable reference to I/O interface (for manipulation or direct control).

Trait Implementations§

Source§

impl<'tree, L, IO, H, C> Debug for Shell<'tree, L, IO, H, C>
where L: AccessLevel, IO: CharIo, H: CommandHandler<C>, C: ShellConfig,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'tree, L, IO, H, C> Freeze for Shell<'tree, L, IO, H, C>
where IO: Freeze, H: Freeze, L: Freeze,

§

impl<'tree, L, IO, H, C> RefUnwindSafe for Shell<'tree, L, IO, H, C>

§

impl<'tree, L, IO, H, C> Send for Shell<'tree, L, IO, H, C>
where IO: Send, H: Send, C: Send, L: Sync + Send,

§

impl<'tree, L, IO, H, C> Sync for Shell<'tree, L, IO, H, C>
where IO: Sync, H: Sync, C: Sync, L: Sync,

§

impl<'tree, L, IO, H, C> Unpin for Shell<'tree, L, IO, H, C>
where IO: Unpin, H: Unpin, C: Unpin, L: Unpin,

§

impl<'tree, L, IO, H, C> UnwindSafe for Shell<'tree, L, IO, H, C>

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.