[][src]Struct shelp::Repl

pub struct Repl<L: LangInterface = DefaultLangInterface> { /* fields omitted */ }

Repl interacts with the terminal to provide easy interactive shells.

Configuration:

  • leader What to print as the prompt:

    > <some-code>
    ^^- leader
    
  • continued_leader If the command is more than one line long, what to print on subsequent lines

    > <some-code>
    . <some-code>
    
  • path Path to a file to use as persistent history. If given, on construction, the history will be populated from the contents of this file, and will automatically write it to the file on being dropped. In case a path is not specified, the history is lost when Repl is dropped.

  • capacity The maximum amount of commands stored in the history. Default capacity is 64. If there are already 64 commands in the history, the oldest one will be forgotten.

Implementations

impl<L: LangInterface> Repl<L>[src]

pub fn iter(self, color: Color) -> ReplIter<L>

Notable traits for ReplIter<L>

impl<L: LangInterface> Iterator for ReplIter<L> type Item = String;
[src]

Shorthand to get iterator from self

impl Repl<DefaultLangInterface>[src]

pub fn newd(
    leader: &'static str,
    continued_leader: &'static str,
    path: Option<PathBuf>
) -> Self
[src]

Create a Repl with default language interface.

pub fn with_capacityd(
    leader: &'static str,
    continued_leader: &'static str,
    capacity: usize,
    path: Option<PathBuf>
) -> Self
[src]

Create a Repl with default language interface, and specified history capacity.

impl<L: LangInterface> Repl<L>[src]

pub fn new(
    leader: &'static str,
    continued_leader: &'static str,
    path: Option<PathBuf>
) -> Self
[src]

Create a Repl with specified language interface.

pub fn with_capacity(
    leader: &'static str,
    continued_leader: &'static str,
    capacity: usize,
    path: Option<PathBuf>
) -> Self
[src]

Create a Repl with specified language interface, and specified history capacity.

pub fn next(&mut self, colour: Color) -> Result<String>[src]

The main function, gives the next command

Trait Implementations

impl<L: LangInterface> Drop for Repl<L>[src]

Auto Trait Implementations

impl<L = DefaultLangInterface> !RefUnwindSafe for Repl<L>

impl<L> Send for Repl<L> where
    L: Send

impl<L = DefaultLangInterface> !Sync for Repl<L>

impl<L> Unpin for Repl<L> where
    L: Unpin

impl<L> UnwindSafe for Repl<L> where
    L: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.