Struct pretty_exec::clap::builder::ValueRange
[−]pub struct ValueRange { /* private fields */ }Expand description
Values per occurrence for an argument
Implementations
impl ValueRange
impl ValueRange
pub const EMPTY: ValueRange = Self{ start_inclusive: 0, end_inclusive: 0,}
pub const EMPTY: ValueRange = Self{ start_inclusive: 0, end_inclusive: 0,}
Nor argument values, or a flag
pub const SINGLE: ValueRange = Self{ start_inclusive: 1, end_inclusive: 1,}
pub const SINGLE: ValueRange = Self{ start_inclusive: 1, end_inclusive: 1,}
A single argument value, the most common case for options
pub 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
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!pub fn min_values(&self) -> usize
pub fn min_values(&self) -> usize
Fewest number of values the argument accepts
pub fn max_values(&self) -> usize
pub fn max_values(&self) -> usize
Most number of values the argument accepts
pub 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
impl Clone for ValueRange
impl Clone for ValueRange
fn clone(&self) -> ValueRange
fn clone(&self) -> ValueRange
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Debug for ValueRange
impl Debug for ValueRange
impl Default for ValueRange
impl Default for ValueRange
fn default() -> ValueRange
fn default() -> ValueRange
Returns the “default value” for a type. Read more
impl Display for ValueRange
impl Display for ValueRange
impl From<Range<usize>> for ValueRange
impl From<Range<usize>> for ValueRange
fn from(range: Range<usize>) -> ValueRange
fn from(range: Range<usize>) -> ValueRange
Converts to this type from the input type.
impl From<RangeFrom<usize>> for ValueRange
impl From<RangeFrom<usize>> for ValueRange
fn from(range: RangeFrom<usize>) -> ValueRange
fn from(range: RangeFrom<usize>) -> ValueRange
Converts to this type from the input type.
impl From<RangeFull> for ValueRange
impl From<RangeFull> for ValueRange
fn from(RangeFull) -> ValueRange
fn from(RangeFull) -> ValueRange
Converts to this type from the input type.
impl From<RangeInclusive<usize>> for ValueRange
impl From<RangeInclusive<usize>> for ValueRange
fn from(range: RangeInclusive<usize>) -> ValueRange
fn from(range: RangeInclusive<usize>) -> ValueRange
Converts to this type from the input type.
impl From<RangeTo<usize>> for ValueRange
impl From<RangeTo<usize>> for ValueRange
fn from(range: RangeTo<usize>) -> ValueRange
fn from(range: RangeTo<usize>) -> ValueRange
Converts to this type from the input type.
impl From<RangeToInclusive<usize>> for ValueRange
impl From<RangeToInclusive<usize>> for ValueRange
fn from(range: RangeToInclusive<usize>) -> ValueRange
fn from(range: RangeToInclusive<usize>) -> ValueRange
Converts to this type from the input type.
impl From<usize> for ValueRange
impl From<usize> for ValueRange
fn from(fixed: usize) -> ValueRange
fn from(fixed: usize) -> ValueRange
Converts to this type from the input type.
impl Hash for ValueRange
impl Hash for ValueRange
impl PartialEq<ValueRange> for ValueRange
impl PartialEq<ValueRange> for ValueRange
fn eq(&self, other: &ValueRange) -> bool
fn eq(&self, other: &ValueRange) -> bool
impl RangeBounds<usize> for ValueRange
impl RangeBounds<usize> for ValueRange
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
impl<I> IntoResettable<ValueRange> for Iwhere
I: Into<ValueRange>,
impl<I> IntoResettable<ValueRange> for Iwhere
I: Into<ValueRange>,
fn into_resettable(self) -> Resettable<ValueRange>
fn into_resettable(self) -> Resettable<ValueRange>
Convert to the intended resettable type
impl<X> Pipe for X
impl<X> Pipe for X
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Returnwhere
Function: FnOnce(&'a Self) -> Return,
fn pipe_ref<'a, Return, Function>(&'a self, f: Function) -> Returnwhere
Function: FnOnce(&'a Self) -> Return,
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Function: FnOnce(&'a mut Self) -> Return,
fn pipe_mut<'a, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Function: FnOnce(&'a mut Self) -> Return,
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_as_ref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: AsRef<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
Apply
f to &self where f takes a single parameter of type Param
and Self implements trait AsRef<Param>. Read morefn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Self: AsMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_as_mut<'a, Param, Return, Function>(&'a mut self, f: Function) -> Returnwhere
Self: AsMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
Apply
f to &mut self where f takes a single parameter of type Param
and Self implements trait AsMut<Param>. Read morefn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_deref<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Deref<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
Apply
f to &self where f takes a single parameter of type Param
and Self implements trait Deref<Target = Param>. Read morefn pipe_deref_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: DerefMut<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_deref_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: DerefMut<Target = Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
Apply
f to &mut self where f takes a single parameter of type Param
and Self implements trait [DerefMut<Target = Param>]. Read morefn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
fn pipe_borrow<'a, Param, Return, Function>(&'a self, f: Function) -> Returnwhere
Self: Borrow<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a Param) -> Return,
Apply
f to &self where f takes a single parameter of type Param
and Self implements trait Borrow<Param>. Read morefn pipe_borrow_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: BorrowMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
fn pipe_borrow_mut<'a, Param, Return, Function>(
&'a mut self,
f: Function
) -> Returnwhere
Self: BorrowMut<Param>,
Param: 'a + ?Sized,
Function: FnOnce(&'a mut Param) -> Return,
Apply
f to &mut self where f takes a single parameter of type Param
and Self implements trait BorrowMut<Param>. Read more