Skip to main content

Command

Trait Command 

Source
pub trait Command: Copy + Sized {
    // Required method
    fn text(&self) -> &str;

    // Provided methods
    fn description(&self) -> Option<Cow<'static, str>> { ... }
    fn info_ui(&self, _ui: &mut Ui) { ... }
    fn formatted_kb_shortcut(&self, _ctx: &Context) -> Option<String> { ... }
}
Expand description

Trait that must be implemented by command types

Required Methods§

Source

fn text(&self) -> &str

The text used for display and fuzzy matching

Provided Methods§

Source

fn description(&self) -> Option<Cow<'static, str>>

A concise description shown inline, right of the name. Default none.

Source

fn info_ui(&self, _ui: &mut Ui)

Detailed information for this command, rendered within the per-entry hover tooltip. Default renders nothing.

Source

fn formatted_kb_shortcut(&self, _ctx: &Context) -> Option<String>

Optional keyboard shortcut for the command

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§