pub struct TupleType { /* private fields */ }Expand description
A composite parameter type that collects multiple values with different types.
Unlike regular types with nargs, each position in a tuple can have
a different type.
Implementations§
Source§impl TupleType
impl TupleType
Source§impl TupleType
impl TupleType
Sourcepub fn convert_element(
&self,
index: usize,
value: &str,
) -> Result<TupleValue, String>
pub fn convert_element( &self, index: usize, value: &str, ) -> Result<TupleValue, String>
Convert a single element at the given index.
This is the preferred way to convert tuple elements - the parser should call this once for each argument consumed.
Sourcepub fn convert_values(&self, values: &[&str]) -> Result<Vec<TupleValue>, String>
pub fn convert_values(&self, values: &[&str]) -> Result<Vec<TupleValue>, String>
Convert a slice of pre-split values into a tuple.
This is the standard Click-compatible conversion - the parser provides already-split argument values.
Trait Implementations§
Source§impl TypeConverter for TupleType
impl TypeConverter for TupleType
Source§type Value = Vec<TupleValue>
type Value = Vec<TupleValue>
The Rust type that this parameter type converts to.
Source§fn convert(&self, value: &str) -> Result<Self::Value, String>
fn convert(&self, value: &str) -> Result<Self::Value, String>
Convert a string value to the target type. Read more
Source§fn get_metavar(&self) -> Option<String>
fn get_metavar(&self) -> Option<String>
Returns the metavar for this type (used in help text). Read more
Source§fn is_composite(&self) -> bool
fn is_composite(&self) -> bool
Whether this type is a composite type (like Tuple).
Source§fn get_missing_message(&self) -> Option<String>
fn get_missing_message(&self) -> Option<String>
Returns an optional message when a required value is missing.
Source§fn split_envvar_value(&self, value: &str) -> Vec<String>
fn split_envvar_value(&self, value: &str) -> Vec<String>
Split an environment variable value into multiple values. Read more
Source§fn shell_complete(&self, _incomplete: &str) -> Vec<CompletionItem>
fn shell_complete(&self, _incomplete: &str) -> Vec<CompletionItem>
Returns shell completion items for the given incomplete value. Read more
Auto Trait Implementations§
impl Freeze for TupleType
impl RefUnwindSafe for TupleType
impl Send for TupleType
impl Sync for TupleType
impl Unpin for TupleType
impl UnsafeUnpin for TupleType
impl UnwindSafe for TupleType
Blanket Implementations§
Source§impl<T> AnyTypeConverter for T
impl<T> AnyTypeConverter for T
Source§fn convert_any(&self, value: &str) -> Result<Box<dyn Any + Sync + Send>, String>
fn convert_any(&self, value: &str) -> Result<Box<dyn Any + Sync + Send>, String>
Convert a string value to the target type, returning as Box.
Source§fn convert_multi(
&self,
values: &[String],
) -> Result<Box<dyn Any + Sync + Send>, String>
fn convert_multi( &self, values: &[String], ) -> Result<Box<dyn Any + Sync + Send>, String>
Convert multiple string values to the target type, returning as Box. Read more
Source§fn get_metavar(&self) -> Option<String>
fn get_metavar(&self) -> Option<String>
Returns the metavar for this type.
Source§fn split_envvar_value(&self, value: &str) -> Vec<String>
fn split_envvar_value(&self, value: &str) -> Vec<String>
Split an environment variable value into multiple values.
Source§fn shell_complete(&self, incomplete: &str) -> Vec<CompletionItem>
fn shell_complete(&self, incomplete: &str) -> Vec<CompletionItem>
Returns shell completion items for the given incomplete value.
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