pub struct PromptWidget {
pub input: String,
pub cursor: usize,
pub context: ContextIndicators,
pub config: PromptConfig,
pub history: Vec<String>,
pub history_index: Option<usize>,
}Expand description
Prompt widget
Fields§
§input: StringInput text
cursor: usizeCursor position
context: ContextIndicatorsContext indicators
config: PromptConfigPrompt configuration
history: Vec<String>Input history
history_index: Option<usize>History index
Implementations§
Source§impl PromptWidget
impl PromptWidget
Sourcepub fn insert_char(&mut self, ch: char)
pub fn insert_char(&mut self, ch: char)
Insert character at cursor
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right
Sourcepub fn move_start(&mut self)
pub fn move_start(&mut self)
Move cursor to start
Sourcepub fn history_up(&mut self)
pub fn history_up(&mut self)
Navigate history up
Sourcepub fn history_down(&mut self)
pub fn history_down(&mut self)
Navigate history down
Sourcepub fn format_prompt(&self) -> String
pub fn format_prompt(&self) -> String
Format the prompt line
Sourcepub fn display_line(&self) -> String
pub fn display_line(&self) -> String
Get the full display line
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PromptWidget
impl RefUnwindSafe for PromptWidget
impl Send for PromptWidget
impl Sync for PromptWidget
impl Unpin for PromptWidget
impl UnwindSafe for PromptWidget
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
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