pub struct CommandSpec<S: Host> {
pub id: &'static str,
pub label: &'static str,
pub menu: &'static [&'static str],
pub shortcut: Option<&'static str>,
pub params: Params,
pub enabled: Enabled<S>,
pub run: Run<S>,
pub mutates: bool,
}Expand description
One command of host state S. Build it with cmd!/query! (the shape of existing
command tables) or with CommandSpec::new and its const setters.
Fields§
§id: &'static str§label: &'static str§shortcut: Option<&'static str>Portable shortcut(s): Mod+Shift+S, alternatives separated by / (see shortcut).
params: Params§enabled: Enabled<S>§run: Run<S>§mutates: boolRecord in the journal / history (false for pure queries and view commands).
Implementations§
Source§impl<S: Host> CommandSpec<S>
impl<S: Host> CommandSpec<S>
Sourcepub const fn new(id: &'static str, label: &'static str, run: Run<S>) -> Self
pub const fn new(id: &'static str, label: &'static str, run: Run<S>) -> Self
A mutating command without menu, shortcut or parameters that is always enabled.
pub const fn shortcut(self, shortcut: &'static str) -> Self
pub const fn enabled(self, enabled: Enabled<S>) -> Self
pub fn params(self, params: Params) -> Self
Auto Trait Implementations§
impl<S> Freeze for CommandSpec<S>
impl<S> RefUnwindSafe for CommandSpec<S>
impl<S> Send for CommandSpec<S>
impl<S> Sync for CommandSpec<S>
impl<S> Unpin for CommandSpec<S>
impl<S> UnsafeUnpin for CommandSpec<S>
impl<S> UnwindSafe for CommandSpec<S>
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