pub struct ValueRange { /* private fields */ }
Expand description
Values per occurrence for an argument
Implementations§
source§impl ValueRange
impl ValueRange
sourcepub const EMPTY: ValueRange = _
pub const EMPTY: ValueRange = _
Nor argument values, or a flag
sourcepub const SINGLE: ValueRange = _
pub const SINGLE: ValueRange = _
A single argument value, the most common case for options
sourcepub fn new(range: impl Into<ValueRange>) -> ValueRange
pub fn new(range: impl Into<ValueRange>) -> ValueRange
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§fn default() -> ValueRange
fn default() -> ValueRange
Returns the “default value” for a type. Read more
source§impl Display for ValueRange
impl Display for ValueRange
source§impl From<RangeFull> for ValueRange
impl From<RangeFull> for ValueRange
source§fn from(_: RangeFull) -> ValueRange
fn from(_: RangeFull) -> ValueRange
Converts to this type from the input type.
source§impl From<RangeInclusive<usize>> for ValueRange
impl From<RangeInclusive<usize>> for ValueRange
source§fn from(range: RangeInclusive<usize>) -> ValueRange
fn from(range: RangeInclusive<usize>) -> ValueRange
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>) -> ValueRange
fn from(range: RangeToInclusive<usize>) -> ValueRange
Converts to this type from the input type.
source§impl From<usize> for ValueRange
impl From<usize> for ValueRange
source§fn from(fixed: usize) -> ValueRange
fn from(fixed: usize) -> ValueRange
Converts to this type from the input type.
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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