pub struct OptionDef {
pub name: String,
pub value_type: OptionValueType,
pub description: String,
pub conflicts_with: Vec<String>,
pub requires: Vec<String>,
pub deprecated: Option<String>,
pub repeatable: bool,
}
Expand description
Definition of a command-line option
Fields§
§name: String
Option name (e.g., “–release”, “–features”)
value_type: OptionValueType
Type of value this option expects
description: String
Human-readable description
conflicts_with: Vec<String>
Options that conflict with this one
requires: Vec<String>
Options that are required when this one is used
deprecated: Option<String>
Deprecation message if this option is deprecated
repeatable: bool
Whether this option can appear multiple times
Implementations§
Source§impl OptionDef
impl OptionDef
Sourcepub fn flag(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn flag(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new flag option
Sourcepub fn single(
name: impl Into<String>,
description: impl Into<String>,
validator: ValueValidator,
) -> Self
pub fn single( name: impl Into<String>, description: impl Into<String>, validator: ValueValidator, ) -> Self
Create a new single value option
Sourcepub fn multiple(
name: impl Into<String>,
description: impl Into<String>,
validator: ValueValidator,
) -> Self
pub fn multiple( name: impl Into<String>, description: impl Into<String>, validator: ValueValidator, ) -> Self
Create a new multiple value option
Sourcepub fn conflicts_with(self, options: Vec<String>) -> Self
pub fn conflicts_with(self, options: Vec<String>) -> Self
Add conflicting options
Sourcepub fn deprecated(self, message: impl Into<String>) -> Self
pub fn deprecated(self, message: impl Into<String>) -> Self
Mark as deprecated
Sourcepub fn repeatable(self) -> Self
pub fn repeatable(self) -> Self
Mark as repeatable
Trait Implementations§
Source§impl<'de> Deserialize<'de> for OptionDef
impl<'de> Deserialize<'de> for OptionDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for OptionDef
impl RefUnwindSafe for OptionDef
impl Send for OptionDef
impl Sync for OptionDef
impl Unpin for OptionDef
impl UnwindSafe for OptionDef
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