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 (debug builds)
§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 PartialEq for ValueRange
impl PartialEq for ValueRange
Source§impl RangeBounds<usize> for ValueRange
impl RangeBounds<usize> for ValueRange
impl Copy for ValueRange
impl Eq for ValueRange
impl StructuralPartialEq for ValueRange
Auto Trait Implementations§
impl Freeze for ValueRange
impl RefUnwindSafe for ValueRange
impl Send for ValueRange
impl Sync for ValueRange
impl Unpin for ValueRange
impl UnwindSafe for ValueRange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I> IntoResettable<ValueRange> for Iwhere
I: Into<ValueRange>,
impl<I> IntoResettable<ValueRange> for Iwhere
I: Into<ValueRange>,
Source§fn into_resettable(self) -> Resettable<ValueRange>
fn into_resettable(self) -> Resettable<ValueRange>
Convert to the intended resettable type
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes