pub enum ArgType {
String,
Path,
Int,
Duration,
Var,
KeyValue,
Any,
OneOf(&'static [&'static str]),
Rest(&'static ArgType),
}Expand description
Closed vocabulary for argument value types.
The closed enum keeps the vocabulary compiler-checked and lets
docs-gen link each type cell to its reference section instead of
printing bare words like duration with no explanation.
Variants§
String
Path
Int
Duration
Var
KeyValue
Any
Any evaluated value (plus stream markers like stdout where the
command accepts them). Renders unlinked as ANY.
OneOf(&'static [&'static str])
Inline alternation for one-off enums (e.g. SNAPSHOT|LOCAL).
Self-describing, so it renders unlinked.
Rest(&'static ArgType)
Trailing variadic repetition (e.g. RUN’s string...).
Implementations§
Source§impl ArgType
impl ArgType
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
Table-cell label for the argument table’s Type column.
Canonical value types use a real crate::ast::TypeKind name.
Reference and assignment shapes ($var, KEY=value), inline
alternations, and ANY render unlinked. Reference and assignment
shapes display as the STRING values they bind or resolve to;
the $/assignment requirement itself lives in the argument
description and command syntax.
Sourcepub fn anchor(&self) -> Option<String>
pub fn anchor(&self) -> Option<String>
Anchor of the type’s reference section, delegated to crate::ast::TypeKind.
Only types with a TypeKind reference section link; argument shapes
($var, KEY=value), inline alternations, and ANY render unlinked.
Sourcepub fn validate_literal(&self, literal: &str) -> Result<()>
pub fn validate_literal(&self, literal: &str) -> Result<()>
Validate a statically-known literal against this type.
Templates and variables are never passed here — see check_arg.
Sourcepub fn check_arg(&self, arg: &Arg) -> Result<CheckOutcome>
pub fn check_arg(&self, arg: &Arg) -> Result<CheckOutcome>
Classify one positional arg for lower-time checking.
Static literals validate now; templates, variables (except a
$var where Var is required), and mixed fragments defer to the
runtime resolvers, which see interpolated values.