pub struct Module {
pub category: String,
pub guides: Vec<GuideEntry>,
pub views: Vec<HumanViewDef>,
pub register: ModuleRegister,
}Expand description
Domain-bounded unit of CLI functionality.
A module usually maps to a product, platform, resource family, or team ownership boundary. It contributes one top-level group plus optional guides and human output views.
Fields§
§category: StringRoot help category.
guides: Vec<GuideEntry>Guide entries merged into the CLI-wide guide command.
views: Vec<HumanViewDef>Human output views registered before command execution.
register: ModuleRegisterRegistration function that returns the module’s runtime group.
Implementations§
Source§impl Module
impl Module
Sourcepub fn new<F>(category: impl Into<String>, register: F) -> Self
pub fn new<F>(category: impl Into<String>, register: F) -> Self
Creates a closure-based module.
Sourcepub fn from_command_module<M>(module: M) -> Selfwhere
M: CommandModule,
pub fn from_command_module<M>(module: M) -> Selfwhere
M: CommandModule,
Converts a trait-based module into the runtime module type.
Sourcepub fn with_guide(self, guide: GuideEntry) -> Self
pub fn with_guide(self, guide: GuideEntry) -> Self
Adds one guide entry.
Sourcepub fn with_guides(self, guides: impl IntoIterator<Item = GuideEntry>) -> Self
pub fn with_guides(self, guides: impl IntoIterator<Item = GuideEntry>) -> Self
Adds several guide entries.
Sourcepub fn with_guides_from_markdown(
self,
files: impl IntoIterator<Item = (impl AsRef<Path>, impl AsRef<[u8]>)>,
) -> Self
pub fn with_guides_from_markdown( self, files: impl IntoIterator<Item = (impl AsRef<Path>, impl AsRef<[u8]>)>, ) -> Self
Parses markdown guide entries from embedded (path, bytes) pairs.
Sourcepub fn with_view(self, view: HumanViewDef) -> Self
pub fn with_view(self, view: HumanViewDef) -> Self
Adds one human output view.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Module
impl !UnwindSafe for Module
impl Freeze for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
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