pub struct OptionDefinition {
pub name: String,
pub short: Option<String>,
pub long: Option<String>,
pub option_type: ArgumentType,
pub required: bool,
pub default: Option<String>,
pub description: String,
pub choices: Vec<String>,
pub repeatable: bool,
pub option_parameters: HashMap<String, Vec<ArgumentDefinition>>,
}Expand description
Definition of a named option (flag)
Options are optional (by default) and can be specified
with short (-o) or long (--option) forms.
§Example
name: output
short: o
long: output
option_type: path
required: false
default: "output.txt"
description: "Output file path"
choices: []Fields§
§name: StringOption name (internal identifier)
short: Option<String>Short form (single character, e.g., “o” for -o)
long: Option<String>Long form (e.g., “output” for –output)
option_type: ArgumentTypeExpected type of the option value
required: boolWhether this option is mandatory
default: Option<String>Default value if not specified
description: StringHuman-readable description
choices: Vec<String>Restricted set of allowed values
If non-empty, the value must be one of these choices. When
repeatable is true, this list also doubles as the set of
valid discriminants for each occurrence (see Self::option_parameters).
repeatable: boolWhether this option can appear more than once on a single
command line, each occurrence carrying its own discriminant
(from choices) and key=value sub-parameters.
Defaults to false — fully backward-compatible with existing
scalar options.
option_parameters: HashMap<String, Vec<ArgumentDefinition>>Per-discriminant shape of the key=value sub-parameters accepted
by a repeatable option.
Keys must exactly match the entries in Self::choices (enforced
by the config validator, not at deserialization time). Each value
reuses ArgumentDefinition — the same vocabulary already used
for positional arguments: — rather than a dedicated mini-schema
type.
Ignored (and should be empty) when repeatable is false.
Trait Implementations§
Source§impl Clone for OptionDefinition
impl Clone for OptionDefinition
Source§fn clone(&self) -> OptionDefinition
fn clone(&self) -> OptionDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OptionDefinition
impl Debug for OptionDefinition
Source§impl<'de> Deserialize<'de> for OptionDefinition
impl<'de> Deserialize<'de> for OptionDefinition
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>,
Source§impl PartialEq for OptionDefinition
impl PartialEq for OptionDefinition
Source§impl Serialize for OptionDefinition
impl Serialize for OptionDefinition
impl StructuralPartialEq for OptionDefinition
Auto Trait Implementations§
impl Freeze for OptionDefinition
impl RefUnwindSafe for OptionDefinition
impl Send for OptionDefinition
impl Sync for OptionDefinition
impl Unpin for OptionDefinition
impl UnsafeUnpin for OptionDefinition
impl UnwindSafe for OptionDefinition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more