One

Struct One 

Source
pub struct One<T> { /* private fields */ }
Expand description

Match an item

§example

let code = "asd".span();
let a = one('a');
let r = a.parse(code);
assert_eq!(r, Some(0..1))

Implementations§

Source§

impl<T> One<T>

Source

pub const fn new(val: T) -> Self

Trait Implementations§

Source§

impl<T: Clone> Clone for One<T>

Source§

fn clone(&self) -> One<T>

Returns a duplicate 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<T: Debug> Debug for One<T>

Source§

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

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

impl<I: TimeTravel, T> Parser<I> for One<T>
where I::Item: PartialEq<T>,

Source§

type Output = Range<usize>

Source§

fn parse(&self, input: I) -> Option<Self::Output>

do parse
Source§

fn map<U, F>(self, f: F) -> Map<Self, I, F>
where Self: Sized, F: FnMut(Self::Output) -> U,

Map a Parser<Output = T> to Parser<Output = U> by applying a function to a contained value
Source§

fn and<B>(self, b: B) -> And<Self, B, I>
where Self: Sized, B: Parser<I>,

Only pass if both subparsers pass
Source§

fn or<B>(self, b: B) -> Or<Self, B, I>
where Self: Sized, B: Parser<I, Output = Self::Output>,

Pass when any subparser passes
Source§

fn not(self) -> Not<Self, I>
where Self: Sized,

Pass if the subparser fail
Source§

fn many(self) -> Many<Self, I>
where Self: Sized,

*, >= 0
Source§

fn many1(self) -> Many<Self, I>
where Self: Sized,

+, >= 1
Source§

fn many_min(self, min: usize) -> Many<Self, I>
where Self: Sized,

{n,}, >= n
Source§

fn many_max(self, max: usize) -> Many<Self, I>
where Self: Sized,

{,m}, <= m
Source§

fn many1_max(self, max: usize) -> Many<Self, I>
where Self: Sized,

{1,m}, >= 1 && <= m
Source§

fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>
where Self: Sized,

{n,m}, >= n && <= m
Source§

fn some(self, count: usize) -> Many<Self, I>
where Self: Sized,

{n}, == n
Source§

fn may(self) -> May<Self, I>
where Self: Sized,

?, 0 or 1
Source§

fn iter(self) -> Iter<Self, I>
where Self: Sized,

Continuously parse into iterators
Source§

fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>
where Self: Sized, U: Parser<I>, F: FnMut(Self::Output) -> U,

Fail if the subparser fail, otherwise calls f with the new Parser and parse the Parser
Source§

fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>
where Self: Sized, U: Parser<I, Output = Self::Output>, F: FnMut() -> U,

Pass if subparser pass, otherwise calls f and parse the result Parser
Source§

fn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
where Self: Sized, F: FnMut(I, Range<usize>) -> Self::Output,

Pass if subparser pass, otherwise calls f with error point Read more
Source§

fn or_trans_noend<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>
where Self: Sized, F: FnMut(I, Range<usize>) -> Self::Output,

Pass if subparser pass, otherwise calls f with error point, but ignore EOF Read more
Source§

fn dyns(self) -> Dyn<I, Self::Output>
where Self: Sized + 'static,

Wrap to dynamic
Source§

impl<T: PartialEq> PartialEq for One<T>

Source§

fn eq(&self, other: &One<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq> Eq for One<T>

Source§

impl<T> StructuralPartialEq for One<T>

Auto Trait Implementations§

§

impl<T> Freeze for One<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for One<T>
where T: RefUnwindSafe,

§

impl<T> Send for One<T>
where T: Send,

§

impl<T> Sync for One<T>
where T: Sync,

§

impl<T> Unpin for One<T>
where T: Unpin,

§

impl<T> UnwindSafe for One<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<S, T> After<T, (T, S)> for S

Source§

fn after(self, v: T) -> (T, S)

Make A Tuple
A.after(B) -> (B, A)
Source§

impl<T> Also for T

Source§

fn also<F>(self, f: F) -> T
where F: FnOnce(&T),

Create an implicit variable, do some extra thing, and return it Read more
Source§

impl<T> AlsoMut for T

Source§

fn also_mut<F>(self, f: F) -> T
where F: FnOnce(&mut T),

Create an implicit variable, do some extra thing, and return it Read more
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<T> IntoArc for T

Source§

fn arc(self) -> Arc<Self>

Source§

fn arc_mutex(self) -> Arc<Mutex<Self>>

Source§

fn arc_rwlock(self) -> Arc<RwLock<Self>>

Source§

impl<T> IntoBox for T

Source§

fn boxed(self) -> Box<Self>

Source§

impl<T> IntoCell for T

Source§

fn cell(self) -> Cell<Self>

Source§

impl<T, E> IntoErr<T> for E

Source§

fn err(self) -> Result<T, Self>

Source§

impl<T> IntoMutex for T

Source§

fn mutex(self) -> Mutex<Self>

Source§

impl<T, E> IntoOk<E> for T

Source§

fn ok(self) -> Result<Self, E>

Source§

impl<T> IntoPinArc for T

Source§

fn pin_arc(self) -> Pin<Arc<Self>>

Source§

impl<T> IntoRc for T

Source§

fn rc(self) -> Rc<Self>

Source§

fn rc_refcell(self) -> Rc<RefCell<Self>>

Source§

fn rc_cell(self) -> Rc<Cell<Self>>

Source§

impl<T> IntoRefCell for T

Source§

fn ref_cell(self) -> RefCell<Self>

Source§

impl<T> IntoRwLock for T

Source§

fn rwlock(self) -> RwLock<Self>

Source§

impl<T> IntoSome for T

Source§

fn some(self) -> Option<Self>

Source§

impl<T> IntoUnsafeCell for T

Source§

unsafe fn unsafe_cell(self) -> UnsafeCell<Self>

Source§

impl<T> Panic for T
where T: Sync + Send + 'static,

Source§

fn panic(self) -> !

Panic Self
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> Todo for T

Source§

fn todo(&self) -> !

Chain call version of todo!()
Source§

impl<T> TodoMsg for T

Source§

fn todo_msg<T>(&self, msg: T) -> !
where T: Display,

Chain call version of todo!(msg)
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.
Source§

impl<T> Used for T

Source§

fn used<F, R>(self, f: F) -> R
where F: FnOnce(T) -> R,

Create an implicit variable, and make a mapping for it Read more
Source§

impl<T> Void for T

Source§

fn void(self)

Drop self
Source§

impl<S, T> With<T, (S, T)> for S

Source§

fn with(self, v: T) -> (S, T)

Make A Tuple
A.after(B) -> (A, B)