Struct bparse::Matches

source ·
pub struct Matches<'i, const N: usize>(pub [&'i [u8]; N], pub &'i [u8]);
Expand description

A container of matched slices. Also stores the remaining input

Tuple Fields§

§0: [&'i [u8]; N]

A list of all the matched slices.

§1: &'i [u8]

What is left of the input

Implementations§

source§

impl<'i> Matches<'i, 0>

source

pub fn new(input: &[u8]) -> Matches<'_, 0>

Returns a new Matches struct with 0 matches

This is useful for starting a chain of pattern tests against input

source§

impl<'i, const N: usize> Matches<'i, N>

source

pub fn ignore(self, p: impl Pattern) -> Option<Matches<'i, N>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct is identical to that in self. This has the effect of ignoring the value matched by p

source§

impl<'i> Matches<'i, 0>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 1>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 1>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 2>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 2>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 3>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 3>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 4>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 4>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 5>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 5>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 6>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 6>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 7>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 7>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 8>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 8>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 9>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 9>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 10>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 10>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 11>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 11>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 12>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 12>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 13>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 13>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 14>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 14>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 15>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 15>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 16>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 16>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 17>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 17>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 18>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 18>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 19>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

source§

impl<'i> Matches<'i, 19>

source

pub fn pattern(self, p: impl Pattern) -> Option<Matches<'i, 20>>

Tests the pattern p against the remaining input in self and returns a new Match struct if p matches.

The array of matched slices in the returned struct will have an additional element corresponding to the value matched by p

This method is implemented for up to 20 elements

Trait Implementations§

source§

impl<'i, const N: usize> Clone for Matches<'i, N>

source§

fn clone(&self) -> Matches<'i, N>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'i, const N: usize> Debug for Matches<'i, N>

source§

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

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

impl<'i, const N: usize> PartialEq for Matches<'i, N>

source§

fn eq(&self, other: &Matches<'i, N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'i, const N: usize> Copy for Matches<'i, N>

source§

impl<'i, const N: usize> Eq for Matches<'i, N>

source§

impl<'i, const N: usize> StructuralEq for Matches<'i, N>

source§

impl<'i, const N: usize> StructuralPartialEq for Matches<'i, N>

Auto Trait Implementations§

§

impl<'i, const N: usize> RefUnwindSafe for Matches<'i, N>

§

impl<'i, const N: usize> Send for Matches<'i, N>

§

impl<'i, const N: usize> Sync for Matches<'i, N>

§

impl<'i, const N: usize> Unpin for Matches<'i, N>

§

impl<'i, const N: usize> UnwindSafe for Matches<'i, N>

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> 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<T> ToOwned for T
where T: Clone,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.