Struct AppHelp

Source
pub struct AppHelp<'a, W> { /* private fields */ }

Implementations§

Source§

impl<'a, W: Write> AppHelp<'a, W>

Source

pub fn new<S: Into<Cow<'a, str>>>( name: S, head: S, foot: S, style: Style, writer: W, max_width: usize, usage_new_line: usize, ) -> Self

Source

pub fn with_global<S: Into<Cow<'a, str>>>( self, name: S, head: S, foot: S, ) -> Self

Source

pub fn foot(&self) -> Cow<'a, str>

Source

pub fn head(&self) -> Cow<'a, str>

Source

pub fn name(&self) -> Cow<'a, str>

Source

pub fn style(&self) -> &Style

Source

pub fn wrap_max_width(&self) -> usize

Source

pub fn usage_new_line(&self) -> usize

Source

pub fn global(&self) -> &Command<'a>

Source

pub fn global_mut(&mut self) -> &mut Command<'a>

Source

pub fn block(&self) -> &[Block<'a, Cow<'a, str>>]

Source

pub fn block_mut(&mut self) -> &mut [Block<'a, Cow<'a, str>>]

Source

pub fn has_cmd(&self) -> bool

If the app has command except global one.

Source

pub fn has_pos(&self) -> bool

If the app has position args in any command.

Source

pub fn find_cmd<S: Into<Cow<'a, str>>>(&self, cmd: S) -> Option<&Command<'a>>

Source

pub fn find_cmd_mut<S: Into<Cow<'a, str>>>( &mut self, cmd: S, ) -> Option<&mut Command<'a>>

Source

pub fn find_block<S: Into<Cow<'a, str>>>( &self, block: S, ) -> Option<&Block<'a, Cow<'a, str>>>

Source

pub fn find_block_mut<S: Into<Cow<'a, str>>>( &mut self, block: S, ) -> Option<&mut Block<'a, Cow<'a, str>>>

Source

pub fn with_name<S: Into<Cow<'a, str>>>(self, name: S) -> Self

Source

pub fn with_head<S: Into<Cow<'a, str>>>(self, head: S) -> Self

Source

pub fn with_foot<S: Into<Cow<'a, str>>>(self, foot: S) -> Self

Source

pub fn with_style(self, style: Style) -> Self

Source

pub fn with_writer(self, writer: W) -> Self

Source

pub fn set_name<S: Into<Cow<'a, str>>>(&mut self, name: S) -> &mut Self

Source

pub fn set_head<S: Into<Cow<'a, str>>>(&mut self, head: S) -> &mut Self

Source

pub fn set_foot<S: Into<Cow<'a, str>>>(&mut self, foot: S) -> &mut Self

Source

pub fn set_style(&mut self, style: Style) -> &mut Self

Source

pub fn set_write(&mut self, writer: W) -> &mut Self

Source

pub fn add_block(&mut self, block: Block<'a, Cow<'a, str>>) -> Result<&mut Self>

Source

pub fn add_cmd<S: Into<Cow<'a, str>>>( &mut self, block: S, cmd: Command<'a>, ) -> Result<&mut Self>

Source

pub fn new_block<S: Into<Cow<'a, str>>>( &mut self, name: S, ) -> Result<AddBlock2App<'a, '_>>

Source

pub fn new_cmd<S: Into<Cow<'a, str>>>( &mut self, block: S, name: S, ) -> Result<AddCmd2App<'a, '_, W>>

Source

pub fn display(&mut self, show_global: bool) -> Result<()>

Source

pub fn display_with<P>(&mut self, policy: P) -> Result<()>
where P: HelpPolicy<'a, Self>,

Source

pub fn display_cmd<S>(&mut self, cmd: S) -> Result<()>
where S: Into<Cow<'a, str>>,

Source

pub fn display_cmd_with<S, P>(&mut self, cmd: S, policy: P) -> Result<()>
where P: HelpPolicy<'a, Command<'a>>, S: Into<Cow<'a, str>>,

Trait Implementations§

Source§

impl<'a, W: Clone> Clone for AppHelp<'a, W>

Source§

fn clone(&self) -> AppHelp<'a, W>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a, W: Debug> Debug for AppHelp<'a, W>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for AppHelp<'_, Stdout>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, W: Write> HelpPolicy<'a, AppHelp<'a, W>> for DefaultAppPolicy<'a, AppHelp<'a, W>>

Source§

fn format(&self, app: &AppHelp<'a, W>) -> Option<Cow<'a, str>>

Auto Trait Implementations§

§

impl<'a, W> Freeze for AppHelp<'a, W>
where W: Freeze,

§

impl<'a, W> RefUnwindSafe for AppHelp<'a, W>
where W: RefUnwindSafe,

§

impl<'a, W> Send for AppHelp<'a, W>
where W: Send,

§

impl<'a, W> Sync for AppHelp<'a, W>
where W: Sync,

§

impl<'a, W> Unpin for AppHelp<'a, W>
where W: Unpin,

§

impl<'a, W> UnwindSafe for AppHelp<'a, W>
where W: UnwindSafe,

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 = Infallible

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.