pub struct CommandPalette { /* private fields */ }Expand description
Command palette widget for quick command access
Implementations§
Source§impl CommandPalette
impl CommandPalette
Sourcepub fn new(commands: Vec<Command>) -> Self
pub fn new(commands: Vec<Command>) -> Self
Create a new command palette with the given commands
Sourcepub fn add_command(&mut self, command: Command)
pub fn add_command(&mut self, command: Command)
Add a command to the palette
Sourcepub fn remove_command(&mut self, id: &str)
pub fn remove_command(&mut self, id: &str)
Remove a command by ID
Sourcepub fn show(&mut self, ctx: &Context, open: &mut bool) -> Option<String>
pub fn show(&mut self, ctx: &Context, open: &mut bool) -> Option<String>
Show the command palette modal
The list stays empty, under an instruction to type, until the query matches commands; the best match is then highlighted. Returns the ID of the executed command if any. Keyboard activation consumes its key so the host can open another dialog in the same frame.
Auto Trait Implementations§
impl !RefUnwindSafe for CommandPalette
impl !UnwindSafe for CommandPalette
impl Freeze for CommandPalette
impl Send for CommandPalette
impl Sync for CommandPalette
impl Unpin for CommandPalette
impl UnsafeUnpin for CommandPalette
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
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