Struct clap_builder::builder::ValueRange
source · pub struct ValueRange { /* private fields */ }
Expand description
Values per occurrence for an argument
Implementations§
source§impl ValueRange
impl ValueRange
sourcepub fn new(range: impl Into<Self>) -> Self
pub fn new(range: impl Into<Self>) -> Self
Create a range
Panics
If the end is less than the start
Examples
let range = ValueRange::new(5);
let range = ValueRange::new(5..10);
let range = ValueRange::new(5..=10);
let range = ValueRange::new(5..);
let range = ValueRange::new(..10);
let range = ValueRange::new(..=10);
While this will panic:
ⓘ
let range = ValueRange::new(10..5); // Panics!
sourcepub fn min_values(&self) -> usize
pub fn min_values(&self) -> usize
Fewest number of values the argument accepts
sourcepub fn max_values(&self) -> usize
pub fn max_values(&self) -> usize
Most number of values the argument accepts
sourcepub fn takes_values(&self) -> bool
pub fn takes_values(&self) -> bool
Report whether the argument takes any values (ie is a flag)
Examples
let range = ValueRange::new(5);
assert!(range.takes_values());
let range = ValueRange::new(0);
assert!(!range.takes_values());
Trait Implementations§
source§impl Clone for ValueRange
impl Clone for ValueRange
source§fn clone(&self) -> ValueRange
fn clone(&self) -> ValueRange
Returns a copy 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 ValueRange
impl Debug for ValueRange
source§impl Default for ValueRange
impl Default for ValueRange
source§impl Display for ValueRange
impl Display for ValueRange
source§impl From<RangeFull> for ValueRange
impl From<RangeFull> for ValueRange
source§impl From<RangeInclusive<usize>> for ValueRange
impl From<RangeInclusive<usize>> for ValueRange
source§fn from(range: RangeInclusive<usize>) -> Self
fn from(range: RangeInclusive<usize>) -> Self
Converts to this type from the input type.
source§impl From<RangeToInclusive<usize>> for ValueRange
impl From<RangeToInclusive<usize>> for ValueRange
source§fn from(range: RangeToInclusive<usize>) -> Self
fn from(range: RangeToInclusive<usize>) -> Self
Converts to this type from the input type.
source§impl From<usize> for ValueRange
impl From<usize> for ValueRange
source§impl Hash for ValueRange
impl Hash for ValueRange
source§impl<I: Into<ValueRange>> IntoResettable<ValueRange> for I
impl<I: Into<ValueRange>> IntoResettable<ValueRange> for I
source§fn into_resettable(self) -> Resettable<ValueRange>
fn into_resettable(self) -> Resettable<ValueRange>
Convert to the intended resettable type
source§impl PartialEq<ValueRange> for ValueRange
impl PartialEq<ValueRange> for ValueRange
source§fn eq(&self, other: &ValueRange) -> bool
fn eq(&self, other: &ValueRange) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.