pub struct CommandPaletteBuilder { /* private fields */ }Expand description
Builder for CommandPalette views.
Implementations§
Source§impl CommandPaletteBuilder
impl CommandPaletteBuilder
pub fn new() -> Self
Sourcepub fn commands(self, commands: Vec<PaletteCommand>) -> Self
pub fn commands(self, commands: Vec<PaletteCommand>) -> Self
Set the available commands.
Sourcepub fn command(self, command: PaletteCommand) -> Self
pub fn command(self, command: PaletteCommand) -> Self
Add a single command.
Sourcepub fn on_query_change(self, callback: impl Fn(String) + 'static) -> Self
pub fn on_query_change(self, callback: impl Fn(String) + 'static) -> Self
Set the callback for query changes.
Sourcepub fn on_select(self, callback: impl Fn(&'static str) + 'static) -> Self
pub fn on_select(self, callback: impl Fn(&'static str) + 'static) -> Self
Set the callback for command selection.
Sourcepub fn on_dismiss(self, callback: impl Fn() + 'static) -> Self
pub fn on_dismiss(self, callback: impl Fn() + 'static) -> Self
Set the callback when dismissed.
pub fn build(self) -> View
Trait Implementations§
Source§impl Default for CommandPaletteBuilder
impl Default for CommandPaletteBuilder
Source§fn default() -> CommandPaletteBuilder
fn default() -> CommandPaletteBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CommandPaletteBuilder
impl !RefUnwindSafe for CommandPaletteBuilder
impl !Send for CommandPaletteBuilder
impl !Sync for CommandPaletteBuilder
impl Unpin for CommandPaletteBuilder
impl !UnwindSafe for CommandPaletteBuilder
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.