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
Custom footer field, see footer
usage: Option<&'static str>
Custom usage field, see usage
Implementations
sourceimpl Info
impl Info
sourcepub const fn version(self, version: &'static str) -> Self
pub const fn version(self, version: &'static str) -> Self
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"));
sourcepub const fn descr(self, descr: &'static str) -> Self
pub const fn descr(self, descr: &'static str) -> Self
Set a program description
let info = Info::default().descr("This program calculates rectangle's area");
See complete example in examples/rectangle.rs
sourcepub const fn header(self, header: &'static str) -> Self
pub const fn header(self, header: &'static str) -> Self
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
sourcepub const fn usage(self, usage: &'static str) -> Self
pub const fn usage(self, usage: &'static str) -> Self
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
sourcepub fn for_parser<T>(self, parser: Parser<T>) -> OptionParser<T> where
T: 'static + Clone + Debug,
pub fn for_parser<T>(self, parser: Parser<T>) -> OptionParser<T> where
T: 'static + Clone + Debug,
Attach additional information to the parser
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Info
impl Send for Info
impl Sync for Info
impl Unpin for Info
impl UnwindSafe for Info
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more