Struct matchers::Matcher

source ·
pub struct Matcher<'a, S = usize, A = DenseDFA<&'a [S], S>>where
    S: StateID,
    A: DFA<ID = S>,{ /* private fields */ }
Expand description

A reference to a Pattern that matches a single input.

Implementations§

source§

impl<'a, S, A> Matcher<'a, S, A>where S: StateID, A: DFA<ID = S>,

source

pub fn is_matched(&self) -> bool

Returns true if this Matcher has matched any input that has been provided.

source

pub fn matches(self, s: &impl AsRef<str>) -> bool

Returns true if this pattern matches the formatted output of the given type implementing fmt::Debug.

source

pub fn debug_matches(self, d: &impl Debug) -> bool

Returns true if this pattern matches the formatted output of the given type implementing fmt::Debug.

source

pub fn display_matches(self, d: &impl Display) -> bool

Returns true if this pattern matches the formatted output of the given type implementing fmt::Display.

source

pub fn read_matches(self, io: impl Read + Sized) -> Result<bool>

Returns either a bool indicating whether or not this pattern matches the data read from the provided io::Read stream, or an io::Error if an error occurred reading from the stream.

Trait Implementations§

source§

impl<'a, S, A> Clone for Matcher<'a, S, A>where S: StateID + Clone, A: DFA<ID = S> + Clone,

source§

fn clone(&self) -> Matcher<'a, S, A>

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<'a, S, A> Debug for Matcher<'a, S, A>where S: StateID + Debug, A: DFA<ID = S> + Debug,

source§

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

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

impl<'a, S, A> Write for Matcher<'a, S, A>where S: StateID, A: DFA<ID = S>,

source§

fn write(&mut self, bytes: &[u8]) -> Result<usize, Error>

Write a buffer into this writer, returning how many bytes were written. Read more
source§

fn flush(&mut self) -> Result<(), Error>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · source§

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
source§

impl<'a, S, A> Write for Matcher<'a, S, A>where S: StateID, A: DFA<ID = S>,

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

§

impl<'a, S, A> RefUnwindSafe for Matcher<'a, S, A>where A: RefUnwindSafe, S: RefUnwindSafe,

§

impl<'a, S, A> Send for Matcher<'a, S, A>where A: Send, S: Send,

§

impl<'a, S, A> Sync for Matcher<'a, S, A>where A: Sync, S: Sync,

§

impl<'a, S, A> Unpin for Matcher<'a, S, A>where A: Unpin, S: Unpin,

§

impl<'a, S, A> UnwindSafe for Matcher<'a, S, A>where A: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.