Struct bpaf::Info

source · []
pub struct Info {
    pub version: Option<&'static str>,
    pub descr: Option<&'static str>,
    pub header: Option<&'static str>,
    pub footer: Option<&'static str>,
    pub usage: Option<&'static str>,
}
Expand description

Information about the parser

let info = Info::default()
               .version(env!("CARGO_PKG_VERSION"))
               .descr("Does mothing")
               .footer("Beware of the Leopard");

Fields

version: Option<&'static str>

version field, see version

descr: Option<&'static str>

Custom description field, see descr

header: Option<&'static str>

Custom header field, see header

footer: Option<&'static str>

Custom footer field, see footer

usage: Option<&'static str>

Custom usage field, see usage

Implementations

Set a version field.

By default bpaf won’t include any version info and won’t accept --version switch

let info = Info::default().version(env!("CARGO_PKG_VERSION"));

Set a program description

let info = Info::default().descr("This program calculates rectangle's area");

See complete example in examples/rectangle.rs

Set a custom header before all the options

let info = Info::default().header("header");

See complete example in examples/rectangle.rs

Set a custom header after all the options

let info = Info::default().header("footer");

See complete example in examples/rectangle.rs

Replace generated usage string with a custom one

let info = Info::default().usage("example [-v] -w <PX> -h <PX>");

See complete example in examples/rectangle.rs

Attach additional information to the parser

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.