Skip to main content

CommandModule

Trait CommandModule 

Source
pub trait CommandModule:
    Send
    + Sync
    + Debug
    + 'static {
    // Required methods
    fn category(&self) -> String;
    fn register(&self, context: &mut ModuleContext<'_>) -> RuntimeGroupSpec;

    // Provided methods
    fn guides(&self) -> Vec<GuideEntry> { ... }
    fn views(&self) -> Vec<HumanViewDef> { ... }
}
Expand description

Trait-based module API for larger command domains.

Implement this when a module has dependencies or enough setup logic that a named type is clearer than a closure.

Required Methods§

Source

fn category(&self) -> String

Help category used in root command long help.

Source

fn register(&self, context: &mut ModuleContext<'_>) -> RuntimeGroupSpec

Registers the module’s top-level runtime group.

Provided Methods§

Source

fn guides(&self) -> Vec<GuideEntry>

Guide entries contributed by this module.

Source

fn views(&self) -> Vec<HumanViewDef>

Human views contributed by this module.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§