Skip to main content

Is

Struct Is 

Source
pub struct Is<I: ?Sized, F> { /* private fields */ }
Expand description

A parser for function is.

Implementations§

Source§

impl<I: ?Sized, F> Is<I, F>

Source

pub fn new(cond: F) -> Self

Creates a new instance.

Trait Implementations§

Source§

impl<I: Clone + ?Sized, F: Clone> Clone for Is<I, F>

Source§

fn clone(&self) -> Is<I, F>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<I: Debug + ?Sized, F: Debug> Debug for Is<I, F>

Source§

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

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

impl<I, F> Parser<I> for Is<I, F>
where I: Positioned + ?Sized, F: FnMut(&I::Ok) -> bool,

Source§

type Output = <I as TryStream>::Ok

The output type for the parser.
Source§

type State = ()

The internal state used in poll_parse. Read more
Source§

fn poll_parse( &mut self, input: Pin<&mut I>, cx: &mut Context<'_>, _state: &mut Self::State, ) -> PolledResult<Self::Output, I>

Parses the input, give an Status.
Source§

impl<I: PartialEq + ?Sized, F: PartialEq> PartialEq for Is<I, F>

Source§

fn eq(&self, other: &Is<I, F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<I: Eq + ?Sized, F: Eq> Eq for Is<I, F>

Source§

impl<I: ?Sized, F> StructuralPartialEq for Is<I, F>

Auto Trait Implementations§

§

impl<I, F> Freeze for Is<I, F>
where F: Freeze, I: ?Sized,

§

impl<I, F> RefUnwindSafe for Is<I, F>

§

impl<I, F> Send for Is<I, F>
where F: Send, I: Send + ?Sized,

§

impl<I, F> Sync for Is<I, F>
where F: Sync, I: Sync + ?Sized,

§

impl<I, F> Unpin for Is<I, F>
where F: Unpin, I: Unpin + ?Sized,

§

impl<I, F> UnsafeUnpin for Is<I, F>
where F: UnsafeUnpin, I: ?Sized,

§

impl<I, F> UnwindSafe for Is<I, F>
where F: UnwindSafe, I: UnwindSafe + ?Sized,

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> 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<P, I> ParserExt<I> for P
where P: Parser<I>, I: Positioned + ?Sized,

Source§

fn parse<'a, 'b>( &'a mut self, input: &'b mut I, ) -> ParseFuture<'a, 'b, Self, I, Self::State>
where I: Unpin,

An asynchronous version of poll_parse, which returns a Future.
Source§

fn boxed<'a>( self, ) -> Box<dyn Parser<I, Output = Self::Output, State = Self::State> + 'a>
where Self: Sized + 'a,

Available on crate feature alloc only.
Wraps the parser into a Box.
Source§

fn no_state(self) -> NoState<Self, Self::State>
where Self: Sized,

Merges State into parser itself.
Source§

fn left<R>(self) -> Either<Self, R>
where Self: Sized, R: Parser<I, Output = Self::Output>,

Wraps the parser into a Either to merge multiple types of parsers.
Source§

fn right<L>(self) -> Either<L, Self>
where Self: Sized, L: Parser<I, Output = Self::Output>,

Wraps the parser into a Either to merge multiple types of parsers.
Source§

fn complete(self) -> Skip<Self, Eof<I>>
where Self: Sized,

Parses the input completedly. Read more
Source§

fn with_position(self) -> WithPosition<Self>
where Self: Sized,

Returns the position of parsed tokens with an output.
Source§

fn peek(self) -> Peek<Self>
where Self: Sized, I: Input,

Returns a parse result without consuming input.
Source§

fn fail(self) -> Fail<Self>
where Self: Sized, I: Input,

Succeeds if the parser failed parsing. Never consumes input.
Source§

fn and<P>(self, p: P) -> (Self, P)
where Self: Sized, P: Parser<I>,

Parses with self, and then with p.
Source§

fn skip<P>(self, p: P) -> Skip<Self, P>
where Self: Sized, P: Parser<I>,

Parses with self, then skips p.
Source§

fn prefix<P>(self, p: P) -> Prefix<Self, P>
where Self: Sized,

Parses with p prefixed by self.
Source§

fn between<L, R>(self, left: L, right: R) -> Skip<Prefix<L, Self>, R>
where Self: Sized, L: Parser<I>, R: Parser<I>,

Parses with self between left and right.
Source§

fn or<P>(self, other: P) -> Or<Self, P>
where Self: Sized, I: Input, P: Parser<I, Output = Self::Output>,

Tries another parser if the parser failed parsing.
Source§

fn opt(self) -> Opt<Self>
where Self: Sized, I: Input,

Returns Some if parsing is succeeded.
Source§

fn once(self) -> Times<Self>
where Self: Sized, I: Positioned,

Returns a IterableParser by wrapping the parser to return output exactly once. Read more
Source§

fn times(self, n: usize) -> Times<Self>
where Self: Sized, I: Positioned,

Returns a IterableParser by repeating the parser exactly n times.
Source§

fn sep_by_times<P, R>(self, sep: P, count: usize) -> SepByTimes<Self, P>
where Self: Sized, P: Parser<I>,

Returns a fixed-size IterableParser of the parser separated by sep.
Source§

fn sep_by_end_times<P, R>(self, sep: P, count: usize) -> SepByEndTimes<Self, P>
where Self: Sized, I: Input, P: Parser<I>,

Returns a fixed-size IterableParser of the parser separated by sep (trailing separater is allowed).
Source§

fn repeat<R>(self, range: R) -> Repeat<Self, R>
where Self: Sized, R: RangeBounds<usize>, I: Input,

Returns a IterableParser by repeating the parser while succeeding.
Source§

fn sep_by<P, R>(self, sep: P, range: R) -> SepBy<Self, P, R>
where Self: Sized, P: Parser<I>, R: RangeBounds<usize>, I: Input,

Returns a IterableParser of the parser separated by sep.
Source§

fn sep_by_end<P, R>(self, sep: P, range: R) -> SepByEnd<Self, P, R>
where Self: Sized, P: Parser<I>, R: RangeBounds<usize>, I: Input,

Returns a IterableParser of the parser separated by sep (trailing separater is allowed).
Source§

fn then<F, Q>(self, f: F) -> Then<Self, F>
where Self: Sized, F: FnMut(Self::Output) -> Q,

Parses with self, passes output to the function f and parses with a returned Parser or IterableParser.
Source§

fn try_then<F, Q, E>(self, f: F) -> TryThen<Self, F>
where Self: Sized, F: FnMut(Self::Output) -> Result<Q, E>, E: Into<Expects>,

Parses with self, passes output to the failable function f and parses with a returned Parser or IterableParser.
Source§

fn until<P>(self, end: P) -> Until<Self, P>
where Self: Sized, P: Parser<I>, I: Input,

Returns a IterableParser by repeating the parser until the parser end succeeds.
Source§

fn discard(self) -> Discard<Self>
where Self: Sized,

Discards the parse results.
Source§

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

Converts an output value into another type.
Source§

fn try_map<F, O, E>(self, f: F) -> TryMap<Self, F>
where Self: Sized, F: FnMut(Self::Output) -> Result<O, E>, E: Into<Expects>,

Converts an output value into another type with a failable function.
Source§

fn satisfy<F, O>(self, f: F) -> Satisfy<Self, F>
where Self: Sized, F: FnMut(&Self::Output) -> bool,

Checks an output value with the function.
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Expects) -> Expects, E: Into<Expects>,

Modifies expected values.
Source§

fn expect<E: Into<Expects>>(self, expected: E) -> Expect<Self>
where Self: Sized, I::Ok: Clone,

Overrides expected values.
Source§

fn spanned(self) -> Spanned<Self>
where Self: Sized,

Overrides the error position by the span of the parse.
Source§

fn exclusive<E: Into<Expects>>(self, expected: E) -> Exclusive<Self>
where Self: Sized, I::Ok: Clone,

Overrides parsing errors as “exclusive”.
Source§

fn rewindable(self) -> Rewindable<Self>
where Self: Sized,

Modifies “exclusive” errors as rewindable.
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, 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.