pub struct CommandArgument {
pub name: String,
pub description: String,
pub required: bool,
pub default: Option<String>,
pub validation_pattern: Option<String>,
pub arg_type: ArgumentType,
}Expand description
A command argument definition
Fields§
§name: StringArgument name
description: StringArgument description
required: boolWhether the argument is required
default: Option<String>Default value if not provided
validation_pattern: Option<String>Validation pattern (regex)
arg_type: ArgumentTypeArgument type (string, number, boolean, etc.)
Implementations§
Source§impl CommandArgument
impl CommandArgument
Sourcepub fn new(name: impl Into<String>, arg_type: ArgumentType) -> Self
pub fn new(name: impl Into<String>, arg_type: ArgumentType) -> Self
Create a new command argument
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description
Sourcepub fn with_required(self, required: bool) -> Self
pub fn with_required(self, required: bool) -> Self
Set whether the argument is required
Sourcepub fn with_default(self, default: impl Into<String>) -> Self
pub fn with_default(self, default: impl Into<String>) -> Self
Set the default value
Sourcepub fn with_validation_pattern(self, pattern: impl Into<String>) -> Self
pub fn with_validation_pattern(self, pattern: impl Into<String>) -> Self
Set the validation pattern
Trait Implementations§
Source§impl Clone for CommandArgument
impl Clone for CommandArgument
Source§fn clone(&self) -> CommandArgument
fn clone(&self) -> CommandArgument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandArgument
impl Debug for CommandArgument
Source§impl<'de> Deserialize<'de> for CommandArgument
impl<'de> Deserialize<'de> for CommandArgument
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 CommandArgument
impl RefUnwindSafe for CommandArgument
impl Send for CommandArgument
impl Sync for CommandArgument
impl Unpin for CommandArgument
impl UnwindSafe for CommandArgument
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