Struct clap::builder::ValueRange
source · [−]pub struct ValueRange { /* private fields */ }
Expand description
Values per occurrence for an argument
Implementations
sourceimpl 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
sourceimpl Clone for ValueRange
impl Clone for ValueRange
sourcefn clone(&self) -> ValueRange
fn clone(&self) -> ValueRange
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for ValueRange
impl Debug for ValueRange
sourceimpl Default for ValueRange
impl Default for ValueRange
sourceimpl Display for ValueRange
impl Display for ValueRange
sourceimpl From<Range<usize>> for ValueRange
impl From<Range<usize>> for ValueRange
sourceimpl From<RangeFrom<usize>> for ValueRange
impl From<RangeFrom<usize>> for ValueRange
sourceimpl From<RangeFull> for ValueRange
impl From<RangeFull> for ValueRange
sourceimpl From<RangeInclusive<usize>> for ValueRange
impl From<RangeInclusive<usize>> for ValueRange
sourcefn from(range: RangeInclusive<usize>) -> Self
fn from(range: RangeInclusive<usize>) -> Self
Converts to this type from the input type.
sourceimpl From<RangeTo<usize>> for ValueRange
impl From<RangeTo<usize>> for ValueRange
sourceimpl From<RangeToInclusive<usize>> for ValueRange
impl From<RangeToInclusive<usize>> for ValueRange
sourcefn from(range: RangeToInclusive<usize>) -> Self
fn from(range: RangeToInclusive<usize>) -> Self
Converts to this type from the input type.
sourceimpl From<usize> for ValueRange
impl From<usize> for ValueRange
sourceimpl Hash for ValueRange
impl Hash for ValueRange
sourceimpl<I: Into<ValueRange>> IntoResettable<ValueRange> for I
impl<I: Into<ValueRange>> IntoResettable<ValueRange> for I
sourcefn into_resettable(self) -> Resettable<ValueRange>
fn into_resettable(self) -> Resettable<ValueRange>
Convert to the intended resettable type
sourceimpl PartialEq<ValueRange> for ValueRange
impl PartialEq<ValueRange> for ValueRange
sourcefn eq(&self, other: &ValueRange) -> bool
fn eq(&self, other: &ValueRange) -> bool
sourceimpl RangeBounds<usize> for ValueRange
impl RangeBounds<usize> for ValueRange
sourcefn start_bound(&self) -> Bound<&usize>
fn start_bound(&self) -> Bound<&usize>
Start index bound. Read more
1.35.0 · sourcefn contains<U>(&self, item: &U) -> boolwhere
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
fn contains<U>(&self, item: &U) -> boolwhere
T: PartialOrd<U>,
U: PartialOrd<T> + ?Sized,
impl Copy for ValueRange
impl Eq for ValueRange
impl StructuralEq for ValueRange
impl StructuralPartialEq for ValueRange
Auto Trait Implementations
impl RefUnwindSafe for ValueRange
impl Send for ValueRange
impl Sync for ValueRange
impl Unpin for ValueRange
impl UnwindSafe for ValueRange
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more