Or

Struct Or 

Source
pub struct Or<F, S> {
    pub first: F,
    pub second: S,
}
Expand description

Matches at least one of the provided atoms, trying first before second.

Fields§

§first: F

The first atom to be checked

§second: S

The second atom to be checked.

If first matches then second would not be tested.

Implementations§

Source§

impl<F, S> Or<F, S>

Source

pub fn new(first: F, second: S) -> Self

Creates a new Or.

Trait Implementations§

Source§

impl<F, S> AlwaysAtom for Or<F, S>
where F: AlwaysAtom, S: Atom,

Source§

fn parse_always(&self, st: &str) -> Match

Returns the length of the match
Source§

impl<F, S> Atom for Or<F, S>
where F: Atom, S: Atom,

Source§

fn parse(&self, st: &str) -> Option<Match>

The main parsing algorithm. Read more
Source§

fn as_dyn(&self) -> &dyn Atom
where Self: Sized,

Coerce to dyn trait
Source§

fn into_tool(self) -> AtomTool<Self>
where Self: Sized,

Converts this atom into a ParseTool. Read more
Source§

impl<'a, FF, F, S, D> ParseTool<'a, FF> for Or<F, S>
where F: ParseTool<'a, FF, Data = D>, S: ParseTool<'a, FF, Data = D>, FF: Clone, D: 'a,

Source§

type Error = <S as ParseTool<'a, FF>>::Error

Error type
Source§

type Data = D

Associated data
Source§

fn parse( &self, st: View<'a, FF>, ) -> Result<(Self::Data, View<'a, FF>), Self::Error>

The main parsing algorithm. Read more

Auto Trait Implementations§

§

impl<F, S> Freeze for Or<F, S>
where F: Freeze, S: Freeze,

§

impl<F, S> RefUnwindSafe for Or<F, S>

§

impl<F, S> Send for Or<F, S>
where F: Send, S: Send,

§

impl<F, S> Sync for Or<F, S>
where F: Sync, S: Sync,

§

impl<F, S> Unpin for Or<F, S>
where F: Unpin, S: Unpin,

§

impl<F, S> UnwindSafe for Or<F, S>
where F: UnwindSafe, S: 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> 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.