pub struct OptSpec<'a, Ctx: ?Sized> { /* private fields */ }Expand description
Option (flag or value-bearing).
Implementations§
Source§impl<'a, Ctx: ?Sized> OptSpec<'a, Ctx>
impl<'a, Ctx: ?Sized> OptSpec<'a, Ctx>
Sourcepub fn flag(name: &'a str, cb: OnFlag<Ctx>) -> Self
pub fn flag(name: &'a str, cb: OnFlag<Ctx>) -> Self
Create a flag option. Other fields are set via builder methods.
Sourcepub const fn value(name: &'a str, cb: OnValue<Ctx>) -> Self
pub const fn value(name: &'a str, cb: OnValue<Ctx>) -> Self
Create a value option. Other fields are set via builder methods.
pub const fn short(self, s: char) -> Self
pub const fn long(self, l: &'a str) -> Self
pub const fn metavar(self, mv: &'a str) -> Self
pub const fn help(self, h: &'a str) -> Self
pub const fn env(self, name: &'a str) -> Self
pub fn default(self, val: impl Into<OsString>) -> Self
pub const fn group(self, g: &'a str) -> Self
pub const fn single(self) -> Self
pub const fn repeatable(self) -> Self
pub const fn validator(self, v: ValueValidator) -> Self
pub const fn get_name(&self) -> &str
pub const fn get_short(&self) -> Option<char>
pub const fn get_long(&self) -> Option<&str>
pub const fn get_metavar(&self) -> Option<&str>
pub const fn get_help(&self) -> Option<&str>
pub const fn get_env(&self) -> Option<&str>
pub const fn get_default(&self) -> Option<&OsString>
pub const fn get_group(&self) -> Option<&str>
pub const fn is_value(&self) -> bool
pub const fn get_repeat(&self) -> Repeat
pub fn get_on_value(&self) -> Option<OnValue<Ctx>>
pub fn get_on_flag(&self) -> Option<OnFlag<Ctx>>
pub fn get_validator(&self) -> Option<ValueValidator>
Auto Trait Implementations§
impl<'a, Ctx> Freeze for OptSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> RefUnwindSafe for OptSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> Send for OptSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> Sync for OptSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> Unpin for OptSpec<'a, Ctx>where
Ctx: ?Sized,
impl<'a, Ctx> UnwindSafe for OptSpec<'a, Ctx>where
Ctx: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more