pub struct SpecArgBuilder { /* private fields */ }Expand description
Builder for SpecArg
Implementations§
Source§impl SpecArgBuilder
impl SpecArgBuilder
Sourcepub fn value_names<I, S>(self, names: I) -> Self
pub fn value_names<I, S>(self, names: I) -> Self
Set the ordered placeholders for a fixed-arity value.
Sourcepub fn default_value(self, value: impl Into<String>) -> Self
pub fn default_value(self, value: impl Into<String>) -> Self
Add a default value (can be called multiple times for var args)
Sourcepub fn default_values<I, S>(self, values: I) -> Self
pub fn default_values<I, S>(self, values: I) -> Self
Add multiple default values at once
Sourcepub fn requires<I, S>(self, selectors: I) -> Self
pub fn requires<I, S>(self, selectors: I) -> Self
Add arguments that must be satisfied when this positional is present.
Sourcepub fn required_if_any<I, S>(self, selectors: I) -> Self
pub fn required_if_any<I, S>(self, selectors: I) -> Self
Add selectors whose presence makes this positional required.
Sourcepub fn required_if_eq(
self,
selector: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn required_if_eq( self, selector: impl Into<String>, value: impl Into<String>, ) -> Self
Add a selector/value condition that makes this positional required.
Sourcepub fn required_if_eq_all<I, S, V>(self, conditions: I) -> Self
pub fn required_if_eq_all<I, S, V>(self, conditions: I) -> Self
Set selector/value conditions which must all match to require this positional.
Sourcepub fn required_unless_any<I, S>(self, selectors: I) -> Self
pub fn required_unless_any<I, S>(self, selectors: I) -> Self
Add selectors where any presence waives this positional’s requirement.
Sourcepub fn required_unless_all<I, S>(self, selectors: I) -> Self
pub fn required_unless_all<I, S>(self, selectors: I) -> Self
Add selectors which must all be present to waive this positional’s requirement.
Sourcepub fn help_heading(self, help_heading: impl Into<String>) -> Self
pub fn help_heading(self, help_heading: impl Into<String>) -> Self
Set environment variable name Heading to list this under in help output.
pub fn env(self, env: impl Into<String>) -> Self
Sourcepub fn env_fallback(self, env: impl Into<String>) -> Self
pub fn env_fallback(self, env: impl Into<String>) -> Self
Add an environment fallback, consulted after the canonical variable.
Sourcepub fn deprecated_env(self, env: impl Into<String>) -> Self
pub fn deprecated_env(self, env: impl Into<String>) -> Self
Add a deprecated environment alias, consulted after ordinary fallbacks.
Sourcepub fn double_dash(self, behavior: SpecDoubleDashChoices) -> Self
pub fn double_dash(self, behavior: SpecDoubleDashChoices) -> Self
Set the double-dash behavior
Sourcepub fn validate(self, expression: impl Into<String>) -> Self
pub fn validate(self, expression: impl Into<String>) -> Self
Set a portable expr expression that must accept each raw value.
Sourcepub fn validate_error(self, message: impl Into<String>) -> Self
pub fn validate_error(self, message: impl Into<String>) -> Self
Set the message reported when validation returns false.
Sourcepub fn usage(self, usage: impl Into<String>) -> Self
pub fn usage(self, usage: impl Into<String>) -> Self
Set the rendered usage string. build derives this when unset.
Sourcepub fn help_first_line(self, text: impl Into<String>) -> Self
pub fn help_first_line(self, text: impl Into<String>) -> Self
Set the first line of help text. Derived from help when unset.
Sourcepub fn effect(self, effect: SpecCommandEffect) -> Self
pub fn effect(self, effect: SpecCommandEffect) -> Self
Raise the command’s effect when this argument is supplied.
Trait Implementations§
Source§impl Clone for SpecArgBuilder
impl Clone for SpecArgBuilder
Source§fn clone(&self) -> SpecArgBuilder
fn clone(&self) -> SpecArgBuilder
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 SpecArgBuilder
impl Debug for SpecArgBuilder
Source§impl Default for SpecArgBuilder
impl Default for SpecArgBuilder
Source§fn default() -> SpecArgBuilder
fn default() -> SpecArgBuilder
Auto Trait Implementations§
impl Freeze for SpecArgBuilder
impl RefUnwindSafe for SpecArgBuilder
impl Send for SpecArgBuilder
impl Sync for SpecArgBuilder
impl Unpin for SpecArgBuilder
impl UnsafeUnpin for SpecArgBuilder
impl UnwindSafe for SpecArgBuilder
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,
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