pub struct CommandPicker {
pub filter: String,
pub selected_index: usize,
pub filtered_commands: Vec<&'static SlashCommand>,
}Expand description
Interactive command picker state
Fields§
§filter: StringCurrent filter text (after the /)
selected_index: usizeCurrently selected index
filtered_commands: Vec<&'static SlashCommand>Filtered commands
Implementations§
Source§impl CommandPicker
impl CommandPicker
pub fn new() -> Self
Sourcepub fn set_filter(&mut self, filter: &str)
pub fn set_filter(&mut self, filter: &str)
Update filter and refresh filtered commands
Sourcepub fn selected_command(&self) -> Option<&'static SlashCommand>
pub fn selected_command(&self) -> Option<&'static SlashCommand>
Get currently selected command
Sourcepub fn render_suggestions(&self) -> usize
pub fn render_suggestions(&self) -> usize
Render the picker suggestions below current line
Sourcepub fn clear_lines(&self, num_lines: usize)
pub fn clear_lines(&self, num_lines: usize)
Clear n lines above cursor
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandPicker
impl RefUnwindSafe for CommandPicker
impl Send for CommandPicker
impl Sync for CommandPicker
impl Unpin for CommandPicker
impl UnwindSafe for CommandPicker
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> 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 moreCreates a shared type from an unshared type.