pub struct NonEmpty<T, C> {
pub first: T,
pub rest: C,
}Expand description
PositionalParameter wrapper for collection types that structurally
guarantees that at least one argument is present.
Collections can be empty, so their Parameter implementations return success
if no values were present on the command line. Wrapping them in this type (for
instance, NonEmpty<String, Vec<String>>) ensures that at least one argument
is present
Fields§
§first: T§rest: CImplementations§
Source§impl<T, C> NonEmpty<T, C>
impl<T, C> NonEmpty<T, C>
pub fn iter(&self) -> NonEmptyIter<<&C as IntoIterator>::IntoIter> ⓘ
Source§impl<T, C> NonEmpty<T, C>
impl<T, C> NonEmpty<T, C>
pub fn iter_mut(&mut self) -> NonEmptyIter<<&mut C as IntoIterator>::IntoIter> ⓘ
Trait Implementations§
Source§impl<T, C> Extend<T> for NonEmpty<T, C>where
C: Extend<T>,
impl<T, C> Extend<T> for NonEmpty<T, C>where
C: Extend<T>,
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a, T, C> IntoIterator for &'a NonEmpty<T, C>
impl<'a, T, C> IntoIterator for &'a NonEmpty<T, C>
Source§impl<'a, T, C> IntoIterator for &'a mut NonEmpty<T, C>
impl<'a, T, C> IntoIterator for &'a mut NonEmpty<T, C>
Source§impl<C: IntoIterator> IntoIterator for NonEmpty<C::Item, C>
impl<C: IntoIterator> IntoIterator for NonEmpty<C::Item, C>
Source§impl<'arg, T, C> PositionalParameter<'arg> for NonEmpty<T, C>
impl<'arg, T, C> PositionalParameter<'arg> for NonEmpty<T, C>
Source§fn arg<E: Error<'arg>>(argument: &'arg Arg) -> Result<Self, E>
fn arg<E: Error<'arg>>(argument: &'arg Arg) -> Result<Self, E>
This parameter appeared on the command line, with an argument.
impl<T: Copy, C: Copy> Copy for NonEmpty<T, C>
impl<T: Eq, C: Eq> Eq for NonEmpty<T, C>
impl<T, C> StructuralPartialEq for NonEmpty<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for NonEmpty<T, C>
impl<T, C> RefUnwindSafe for NonEmpty<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for NonEmpty<T, C>
impl<T, C> Sync for NonEmpty<T, C>
impl<T, C> Unpin for NonEmpty<T, C>
impl<T, C> UnwindSafe for NonEmpty<T, C>where
T: UnwindSafe,
C: UnwindSafe,
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<'arg, T> Parameter<'arg> for Twhere
T: PositionalParameter<'arg>,
impl<'arg, T> Parameter<'arg> for Twhere
T: PositionalParameter<'arg>,
Source§fn absent() -> Result<T, RequiredError>
fn absent() -> Result<T, RequiredError>
This parameter was absent from the command line. Read more
Source§fn arg<E>(argument: &'arg Arg) -> Result<T, E>where
E: Error<'arg>,
fn arg<E>(argument: &'arg Arg) -> Result<T, E>where
E: Error<'arg>,
This parameter got an argument from the command line. Read more
Source§fn present<E>(argument: impl ArgAccess<'arg>) -> Result<T, E>where
E: Error<'arg>,
fn present<E>(argument: impl ArgAccess<'arg>) -> Result<T, E>where
E: Error<'arg>,
This parameter appeared on the command line. Read more