Skip to main content

FlattenGroup

Struct FlattenGroup 

Source
pub struct FlattenGroup<'a> {
    pub name: &'a str,
    pub start: usize,
    pub meta: &'a CommandMeta<'a>,
    pub help_heading: Option<&'a str>,
}
Expand description

A run of one command’s flags that arrived from a flattened Args type.

#[usage(flatten)] splices a struct’s declarations into the command that holds it, so a set of flags shared by thirty commands is thirty identical copies in the emitted spec. This records the seam the expansion leaves behind, so Spec::to_kdl can write the set once as a flagset and a use in each command that has it.

Fields§

§name: &'a str

The name the emitted flagset is given: the flattened type’s, in kebab-case.

§start: usize

Where this group’s flags begin in the flattening command’s flag list.

§meta: &'a CommandMeta<'a>

The flattened type’s own metadata.

The flagset’s body comes from here rather than from the parent’s slice, so a struct that flattens another can be written as a set that uses a set.

§help_heading: Option<&'a str>

Heading for this group’s unheaded flags, from next_help_heading on the flatten site.

A field that already names a heading keeps it. This is clap’s #[command(flatten, next_help_heading = "…")]: the section is declared where the group is mounted, not on every field inside it.

Trait Implementations§

Source§

impl<'a> Clone for FlattenGroup<'a>

Source§

fn clone(&self) -> FlattenGroup<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for FlattenGroup<'a>

Source§

impl<'a> Debug for FlattenGroup<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for FlattenGroup<'a>

§

impl<'a> RefUnwindSafe for FlattenGroup<'a>

§

impl<'a> Send for FlattenGroup<'a>

§

impl<'a> Sync for FlattenGroup<'a>

§

impl<'a> Unpin for FlattenGroup<'a>

§

impl<'a> UnsafeUnpin for FlattenGroup<'a>

§

impl<'a> UnwindSafe for FlattenGroup<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.