pub struct InputComposer { /* private fields */ }Expand description
A simple input composer that supports multi-line input, history navigation, and basic slash-command completion.
Implementations§
Source§impl InputComposer
impl InputComposer
Sourcepub fn add_commands(&mut self, cmds: &[&str])
pub fn add_commands(&mut self, cmds: &[&str])
Add commands to the autocomplete list.
Sourcepub fn add_history(&mut self, line: &str)
pub fn add_history(&mut self, line: &str)
Add a line to history.
Sourcepub fn read_input(&mut self) -> Result<String>
pub fn read_input(&mut self) -> Result<String>
Read a complete input (terminated by empty line or Ctrl+D).
Sourcepub fn autocomplete(&self, partial: &str) -> Vec<String>
pub fn autocomplete(&self, partial: &str) -> Vec<String>
Auto-complete a partial slash command.
Sourcepub fn history_up(&mut self) -> Option<&str>
pub fn history_up(&mut self) -> Option<&str>
Navigate history up (older entry).
Sourcepub fn history_down(&mut self) -> Option<&str>
pub fn history_down(&mut self) -> Option<&str>
Navigate history down (newer entry).
Sourcepub fn get_history(&self) -> &[String]
pub fn get_history(&self) -> &[String]
Get the command history.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputComposer
impl RefUnwindSafe for InputComposer
impl Send for InputComposer
impl Sync for InputComposer
impl Unpin for InputComposer
impl UnsafeUnpin for InputComposer
impl UnwindSafe for InputComposer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more