pub struct Command { /* private fields */ }Expand description
Command palette component
§Example
use armas_basic::components::Command;
let mut cmd = Command::new().placeholder("Type a command...");
let response = cmd.show(ui, |builder| {
builder.item("open", "Open File");
builder.item("save", "Save");
builder.item("quit", "Quit");
});
if let Some(id) = response.executed {
// handle executed command id
}Implementations§
Source§impl Command
impl Command
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Set placeholder text for the search input
Sourcepub const fn trigger(self, key: Key, modifiers: Modifiers) -> Self
pub const fn trigger(self, key: Key, modifiers: Modifiers) -> Self
Set the keyboard shortcut to trigger the command palette
Sourcepub const fn max_height(self, max_height: f32) -> Self
pub const fn max_height(self, max_height: f32) -> Self
Set the panel max height
Sourcepub fn show<R>(
&mut self,
ui: &mut Ui,
content: impl FnOnce(&mut CommandBuilder<'_>) -> R,
) -> CommandResponse
pub fn show<R>( &mut self, ui: &mut Ui, content: impl FnOnce(&mut CommandBuilder<'_>) -> R, ) -> CommandResponse
Show the command palette
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
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