Skip to main content

Matcher

Struct Matcher 

Source
pub struct Matcher<'a> { /* private fields */ }
Expand description

Reads tokens, queries and data from a string

Implementations§

Source§

impl<'a> Matcher<'a>

Source

pub fn new(src: &'a str) -> Self

Create a new Matcher instance

Source

pub fn next_static(&mut self) -> Result<&'a str, MatchError>

Get the next static token from the string

Source

pub fn next_query(&mut self) -> Result<Vec<Query<'a>>, MatchError>

Get the next NLOQ query from the string

Source

pub fn next_query_owned(&mut self) -> Result<Vec<Query<'static>>, MatchError>

Get the next NLOQ query from the string

Source

pub fn next_data<T>(&mut self) -> Result<T, MatchError>
where T: Deserialize<'a>,

Get the next NLSD object from the string and deserialize into T

Source

pub fn is_empty(&self) -> bool

Check if the matcher contains more tokens

Auto Trait Implementations§

§

impl<'a> Freeze for Matcher<'a>

§

impl<'a> RefUnwindSafe for Matcher<'a>

§

impl<'a> Send for Matcher<'a>

§

impl<'a> Sync for Matcher<'a>

§

impl<'a> Unpin for Matcher<'a>

§

impl<'a> UnsafeUnpin for Matcher<'a>

§

impl<'a> UnwindSafe for Matcher<'a>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

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.