Struct Help

Source
pub struct Help { /* private fields */ }
Expand description

Holds help text blocks and help options blocks.

And this struct creates a HelpIter instance which outputs a help text line by line.

Implementations§

Source§

impl Help

Source

pub fn new() -> Self

Constructs an Help instance with 0 margins.

Source

pub fn with_margins(margin_left: usize, margin_right: usize) -> Self

Constructs an Help instance with left and right margins.

Source

pub fn add_text(&mut self, text: String)

Adds a text for a help text block to this help instance.

The indent width of this help text block is set to auto indentation. The margins of a help text generated by this instance equals them which specified at a constructor.

Source

pub fn add_text_with_indent(&mut self, text: String, indent: usize)

Adds a text and an indent width for a help text block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at a constructor.

Source

pub fn add_text_with_margins( &mut self, text: String, margin_left: usize, margin_right: usize, )

Adds a text and margins for a help text block to this help instance.

The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to auto indentation.

Source

pub fn add_text_with_indent_and_margins( &mut self, text: String, indent: usize, margin_left: usize, margin_right: usize, )

Adds a text and an indent width and margins for a help text block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.

Source

pub fn add_texts(&mut self, texts: Vec<String>)

Adds texts for a help text block to this help instance.

The indent width of this help text block is set to auto indentation. The margins of a help text generated by this instance equals them which specified at a constructor.

Source

pub fn add_texts_with_indent(&mut self, texts: Vec<String>, indent: usize)

Adds texts and an indent width for a help text block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at the new function.

Source

pub fn add_texts_with_margins( &mut self, texts: Vec<String>, margin_left: usize, margin_right: usize, )

Adds texts and an indent width and margins for a help text block to this help instance.

The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to auto indentation.

Source

pub fn add_texts_with_indent_and_margins( &mut self, texts: Vec<String>, indent: usize, margin_left: usize, margin_right: usize, )

Adds texts and an indent width and margins for a help text block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.

Source

pub fn add_opts(&mut self, cfgs: &[OptCfg])

Adds OptCfg(s) for a help option block to this help instance.

The indent width of this help text block is set to auto indentation. The margins of a help text generated by this instance equals them which specified at a constructor.

Source

pub fn add_opts_with_indent(&mut self, cfgs: &[OptCfg], indent: usize)

Adds OptCfg(s) and an indent width for a help option block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at a constructor.

Source

pub fn add_opts_with_margins( &mut self, cfgs: &[OptCfg], margin_left: usize, margin_right: usize, )

Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.

The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to auto indentation.

Source

pub fn add_opts_with_indent_and_margins( &mut self, cfgs: &[OptCfg], indent: usize, margin_left: usize, margin_right: usize, )

Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.

The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.

Source

pub fn iter(&self) -> HelpIter<'_>

Creates a HelpIter instance which is an iterator that outputs a help text line by line.

Source

pub fn print(&self)

Outputs a help text to the standard output.

Auto Trait Implementations§

§

impl Freeze for Help

§

impl RefUnwindSafe for Help

§

impl Send for Help

§

impl Sync for Help

§

impl Unpin for Help

§

impl UnwindSafe for Help

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T