pub struct FuzzySelect { /* private fields */ }Expand description
An inline fuzzy-select prompt.
§Examples
use sparcli::{FuzzySelect, Outcome};
if let Outcome::Submitted(index) =
FuzzySelect::new("Find a fruit:").options(["apple", "banana"]).run()?
{
println!("chose option {index}");
}Implementations§
Source§impl FuzzySelect
impl FuzzySelect
Sourcepub fn shortcuts<I>(self, shortcuts: I) -> Selfwhere
I: IntoIterator<Item = Shortcut>,
pub fn shortcuts<I>(self, shortcuts: I) -> Selfwhere
I: IntoIterator<Item = Shortcut>,
Registers shortcuts shown in a footer hint.
Pressing a bound key ends the prompt with Outcome::Shortcut. Use
modified keys (e.g. Ctrl-…) so they do not collide with typing.
Sourcepub fn max_visible(self, rows: usize) -> Self
pub fn max_visible(self, rows: usize) -> Self
Sets the maximum number of visible result rows.
Sourcepub fn run(self) -> Result<Outcome<usize>>
pub fn run(self) -> Result<Outcome<usize>>
Runs a single-select fuzzy prompt, returning the chosen index.
§Errors
Returns SparcliError::NoTerminal without an interactive terminal,
or SparcliError::Io on a terminal failure.
Sourcepub fn run_multi(self) -> Result<Outcome<Vec<usize>>>
pub fn run_multi(self) -> Result<Outcome<Vec<usize>>>
Runs a multi-select fuzzy prompt, returning all checked indices.
§Errors
Returns SparcliError::NoTerminal without an interactive terminal,
or SparcliError::Io on a terminal failure.
Auto Trait Implementations§
impl Freeze for FuzzySelect
impl RefUnwindSafe for FuzzySelect
impl Send for FuzzySelect
impl Sync for FuzzySelect
impl Unpin for FuzzySelect
impl UnsafeUnpin for FuzzySelect
impl UnwindSafe for FuzzySelect
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