pub struct OptionSpec { /* private fields */ }Implementations§
Source§impl OptionSpec
impl OptionSpec
pub fn flag(long: impl Into<String>) -> Self
pub fn value(long: impl Into<String>) -> Self
pub fn short(self, short: char) -> Self
pub fn optional_value(self) -> Self
pub fn value_name(self, name: impl Into<String>) -> Self
pub fn value_type(self, value_type: ValueType) -> Self
pub fn possible_value(self, value: impl Into<String>) -> Self
pub fn about(self, about: impl Into<String>) -> Self
pub fn required(self, required: bool) -> Self
pub fn repeatable(self, repeatable: bool) -> Self
Sourcepub fn detached_optional_value(self, enabled: bool) -> Self
pub fn detached_optional_value(self, enabled: bool) -> Self
Allows an optional value to be supplied as the following argument.
Optional values remain attached-only by default because a detached text
value may otherwise consume a positional argument. Prefer a bounded
ValueType such as ValueType::Bool when enabling this behavior.
pub fn terminal(self, terminal: bool) -> Self
pub fn conflicts_with(self, long: impl Into<String>) -> Self
pub fn requires(self, long: impl Into<String>) -> Self
Sourcepub fn env(self, name: impl Into<String>) -> Self
pub fn env(self, name: impl Into<String>) -> Self
Uses a declared environment variable when argv omits this option.
Sourcepub fn default_value(self, value: impl Into<OsString>) -> Self
pub fn default_value(self, value: impl Into<OsString>) -> Self
Uses one fallback value after argv and environment resolution.
Sourcepub fn value_kind(self, kind: ValueKind) -> Self
pub fn value_kind(self, kind: ValueKind) -> Self
Selects additional native path or network-address validation.
Sourcepub fn exclusive_group(self, name: impl Into<String>) -> Self
pub fn exclusive_group(self, name: impl Into<String>) -> Self
Joins an at-most-one group. Requirements may reference the group name.
pub fn long(&self) -> &str
pub fn short_name(&self) -> Option<char>
pub fn value_mode(&self) -> ValueMode
pub fn value_name_text(&self) -> &str
pub fn value_type_kind(&self) -> ValueType
pub fn possible_values(&self) -> &[String]
pub fn about_text(&self) -> &str
pub fn is_required(&self) -> bool
pub fn is_repeatable(&self) -> bool
pub fn accepts_detached_optional_value(&self) -> bool
pub fn is_terminal(&self) -> bool
pub fn conflicts(&self) -> &[String]
pub fn requirements(&self) -> &[String]
Trait Implementations§
Source§impl Clone for OptionSpec
impl Clone for OptionSpec
Source§impl Debug for OptionSpec
impl Debug for OptionSpec
impl Eq for OptionSpec
Source§impl PartialEq for OptionSpec
impl PartialEq for OptionSpec
impl StructuralPartialEq for OptionSpec
Auto Trait Implementations§
impl Freeze for OptionSpec
impl RefUnwindSafe for OptionSpec
impl Send for OptionSpec
impl Sync for OptionSpec
impl Unpin for OptionSpec
impl UnsafeUnpin for OptionSpec
impl UnwindSafe for OptionSpec
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