Skip to main content

Repeat

Struct Repeat 

Source
pub struct Repeat<T, const MIN: usize, const MAX: usize> { /* private fields */ }
Expand description

Parses T between MIN and MAX times, inclusive.

MIN must be less than or equal to MAX.

Implementations§

Source§

impl<T, const MIN: usize, const MAX: usize> Repeat<T, MIN, MAX>

Source

pub fn items(&self) -> &[T]

Returns the parsed items.

Source

pub fn into_items(self) -> Vec<T>

Returns the parsed items and consumes the wrapper.

Source

pub fn len(&self) -> usize

Returns the number of parsed items.

Source

pub fn is_empty(&self) -> bool

Returns whether no items were parsed.

Trait Implementations§

Source§

impl<T: Clone, const MIN: usize, const MAX: usize> Clone for Repeat<T, MIN, MAX>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, const MIN: usize, const MAX: usize> Debug for Repeat<T, MIN, MAX>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Eq, const MIN: usize, const MAX: usize> Eq for Repeat<T, MIN, MAX>

Source§

impl<T: Hash, const MIN: usize, const MAX: usize> Hash for Repeat<T, MIN, MAX>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Ord, const MIN: usize, const MAX: usize> Ord for Repeat<T, MIN, MAX>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl<'a, I, T, const MIN: usize, const MAX: usize> Parse<'a, I> for Repeat<T, MIN, MAX>
where I: Input<'a>, T: Parse<'a, I>,

Source§

fn parse_with_context( input: I, context: &mut ParseOffsetContext, ) -> ParseResult<(Self, I)>

Parse a value from the input using an explicit offset context.
Source§

fn parse(input: I) -> ParseResult<(Self, I)>
where I: ParseOffsetInput<'a>,

Parse a value from the input. Read more
Source§

impl<T: PartialEq, const MIN: usize, const MAX: usize> PartialEq for Repeat<T, MIN, MAX>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialOrd, const MIN: usize, const MAX: usize> PartialOrd for Repeat<T, MIN, MAX>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: PartialEq, const MIN: usize, const MAX: usize> StructuralPartialEq for Repeat<T, MIN, MAX>

Source§

impl<T, U, const MIN: usize, const MAX: usize> Unpack<Vec<U>> for Repeat<T, MIN, MAX>
where T: Unpack<U>,

Source§

fn unpack(self) -> Vec<U>

Unpacks self into T.

Auto Trait Implementations§

§

impl<T, const MIN: usize, const MAX: usize> Forget for Repeat<T, MIN, MAX>

§

impl<T, const MIN: usize, const MAX: usize> Freeze for Repeat<T, MIN, MAX>
where *const u8 is !null: Freeze, PhantomData<T>: Freeze,

§

impl<T, const MIN: usize, const MAX: usize> Move for Repeat<T, MIN, MAX>

§

impl<T, const MIN: usize, const MAX: usize> RefUnwindSafe for Repeat<T, MIN, MAX>
where T: RefUnwindSafe,

§

impl<T, const MIN: usize, const MAX: usize> Send for Repeat<T, MIN, MAX>
where T: Send, RawVecInner: Send,

§

impl<T, const MIN: usize, const MAX: usize> Sync for Repeat<T, MIN, MAX>
where T: Sync, RawVecInner: Sync,

§

impl<T, const MIN: usize, const MAX: usize> Unpin for Repeat<T, MIN, MAX>
where T: Unpin, *const u8 is !null: Unpin,

§

impl<T, const MIN: usize, const MAX: usize> UnsafeUnpin for Repeat<T, MIN, MAX>

§

impl<T, const MIN: usize, const MAX: usize> UnwindSafe for Repeat<T, MIN, MAX>
where RawVecInner: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, I, T> ParseExt<'a, I> for T
where I: Input<'a>, T: Parse<'a, I>,

Source§

fn parse_complete(input: I) -> ParseResult<Self>
where I: ParseOffsetInput<'a>,

Parses a value and requires all input to be consumed.
Source§

fn parse_prefix(input: I) -> ParseResult<(Self, I)>
where I: ParseOffsetInput<'a>,

Parses a value and returns the remaining input.
Source§

impl<T> SpacedExt for T

Source§

type Spaced = Spaced<T>

Parser output wrapped with leading and trailing whitespace handling.
Source§

fn parse_spaced<'a, I>(input: I) -> ParseResult<(Self::Spaced, I)>
where I: ParseOffsetInput<'a>, Self::Spaced: Parse<'a, I>,

Parses Self after trimming leading and trailing whitespace.
Source§

impl<T> SpanExt for T

Source§

type Spanned = Span<T>

The parser output type wrapped with span metadata.
Source§

fn parse_spanned<'a, I>(input: I) -> ParseResult<(Self::Spanned, I)>
where I: ParseOffsetInput<'a>, Self::Spanned: Parse<'a, I>,

Parse Self and return the parsed value wrapped with its consumed span.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WsExt for T

Source§

type Whitespaced = Ws<T>

Parser output wrapped with leading-whitespace handling.
Source§

fn parse_ws<'a, I>(input: I) -> ParseResult<(Self::Whitespaced, I)>
where I: ParseOffsetInput<'a>, Self::Whitespaced: Parse<'a, I>,

Parses Self after trimming leading whitespace.