Struct combine::parser::repeat::Count

source ·
pub struct Count<F, Input, P>
where <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>, Input: Stream + Stream, P: Parser<Input>, F: Extend<P::Output> + Default,
{ pub count: usize, pub parser: P, /* private fields */ }

Fields§

§count: usize§parser: P

Trait Implementations§

source§

impl<F, Input, P> Parser<Input> for Count<F, Input, P>
where <Input as StreamOnce>::Error: ParseError<<Input as StreamOnce>::Token, <Input as StreamOnce>::Range, <Input as StreamOnce>::Position>, Input: Stream + Stream, P: Parser<Input>, F: Extend<P::Output> + Default,

§

type Output = F

The type which is returned if the parser is successful.
§

type PartialState = ()

Determines the state necessary to resume parsing after more input is supplied. Read more
source§

fn add_error(&mut self, errors: &mut Tracked<<Input as StreamOnce>::Error>)

Adds the first error that would normally be returned by this parser if it failed with an PeekErr result. Read more
source§

fn parse( &mut self, input: Input ) -> Result<(Self::Output, Input), <Input as StreamOnce>::Error>

Entry point of the parser. Takes some input and tries to parse it. Read more
source§

fn parse_with_state( &mut self, input: &mut Input, state: &mut Self::PartialState ) -> Result<Self::Output, <Input as StreamOnce>::Error>

Entry point of the parser when using partial parsing. Takes some input and tries to parse it. Read more
source§

fn parse_stream( &mut self, input: &mut Input ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>

Parses using the stream input by calling Stream::uncons one or more times. Read more
source§

fn parse_lazy( &mut self, input: &mut Input ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>

Parses using the stream input by calling Stream::uncons one or more times. Read more
source§

fn parse_stream_partial( &mut self, input: &mut Input, state: &mut Self::PartialState ) -> ParseResult<Self::Output, <Input as StreamOnce>::Error>

Like parse_stream but supports partial parsing.
source§

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

Borrows a parser instead of consuming it. Read more
source§

fn with<P2>(self, p: P2) -> With<Self, P2>
where Self: Sized, P2: Parser<Input>,

Discards the value of the self parser and returns the value of p. Fails if any of the parsers fails. Read more
source§

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

Discards the value of the p parser and returns the value of self. Fails if any of the parsers fails. Read more
source§

fn and<P2>(self, p: P2) -> (Self, P2)
where Self: Sized, P2: Parser<Input>,

Parses with self followed by p. Succeeds if both parsers succeed, otherwise fails. Returns a tuple with both values on success. Read more
source§

fn or<P2>(self, p: P2) -> Or<Self, P2>
where Self: Sized, P2: Parser<Input, Output = Self::Output>,

Returns a parser which attempts to parse using self. If self fails without committing it tries to consume the same input using p. Read more
source§

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

Parses using self and then passes the value to f which returns a parser used to parse the rest of the input. Read more
source§

fn then_partial<N, F>(self, f: F) -> ThenPartial<Self, F>
where Self: Sized, F: FnMut(&mut Self::Output) -> N, N: Parser<Input>,

Variant of then which parses using self and then passes the value to f as a &mut reference. Read more
source§

fn then_ref<N, F>(self, f: F) -> ThenRef<Self, F>
where Self: Sized, F: FnMut(&Self::Output) -> N, N: Parser<Input>,

Parses using self and then passes a reference to the value to f which returns a parser used to parse the rest of the input. The value is then combined with the output of f. Read more
source§

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

Uses f to map over the parsed value. Read more
source§

fn map_input<F, B>(self, f: F) -> MapInput<Self, F>
where Self: Sized, F: FnMut(Self::Output, &mut Input) -> B,

source§

fn flat_map<F, B>(self, f: F) -> FlatMap<Self, F>
where Self: Sized, F: FnMut(Self::Output) -> Result<B, <Input as StreamOnce>::Error>,

Uses f to map over the output of self. If f returns an error the parser fails. Read more
source§

fn message<S>(self, msg: S) -> Message<Self, S>
where Self: Sized, S: for<'s> ErrorInfo<'s, Input::Token, Input::Range>,

Parses with self and if it fails, adds the message msg to the error. Read more
source§

fn expected<S>(self, msg: S) -> Expected<Self, S>
where Self: Sized, S: for<'s> ErrorInfo<'s, Input::Token, Input::Range>,

Parses with self and if it fails without consuming any input any expected errors are replaced by msg. msg is then used in error messages as “Expected msg”. Read more
source§

fn silent(self) -> Silent<Self>
where Self: Sized,

Parses with self, if it fails without consuming any input any expected errors that would otherwise be emitted by self are suppressed. Read more
source§

fn and_then<F, O, E>(self, f: F) -> AndThen<Self, F>
where Self: Parser<Input> + Sized, F: FnMut(Self::Output) -> Result<O, E>, E: Into<<Input::Error as ParseError<Input::Token, Input::Range, Input::Position>>::StreamError>,

Parses with self and applies f on the result if self parses successfully. f may optionally fail with an error which is automatically converted to a ParseError. Read more
source§

fn iter( self, input: &mut Input ) -> Iter<'_, Input, Self, Self::PartialState, FirstMode>
where Self: Parser<Input> + Sized,

Creates an iterator from a parser and a state. Can be used as an alternative to many when collecting directly into a Extend type is not desirable. Read more
source§

fn partial_iter<'a, 's, M>( self, mode: M, input: &'a mut Input, partial_state: &'s mut Self::PartialState ) -> Iter<'a, Input, Self, &'s mut Self::PartialState, M>
where Self: Parser<Input> + Sized, M: ParseMode,

Creates an iterator from a parser and a state. Can be used as an alternative to many when collecting directly into a Extend type is not desirable. Read more
source§

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

Available on crate feature std only.
Turns the parser into a trait object by putting it in a Box. Can be used to easily return parsers from functions without naming the type. Read more
source§

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

Wraps the parser into the Either enum which allows combinators such as then to return multiple different parser types (merging them to one) Read more
source§

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

Wraps the parser into the Either enum which allows combinators such as then to return multiple different parser types (merging them to one) Read more
source§

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

Marks errors produced inside the self parser with the span from the start of the parse to the end of it. Read more

Auto Trait Implementations§

§

impl<F, Input, P> Freeze for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: Freeze,

§

impl<F, Input, P> RefUnwindSafe for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: RefUnwindSafe,

§

impl<F, Input, P> Send for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: Send,

§

impl<F, Input, P> Sync for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: Sync,

§

impl<F, Input, P> Unpin for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: Unpin,

§

impl<F, Input, P> UnwindSafe for Count<F, Input, P>
where <Input as StreamOnce>::Error: Sized, P: 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<Input, P> EasyParser<Input> for P
where P: Parser<Stream<Input>> + ?Sized, Input: Stream, <Input as StreamOnce>::Token: PartialEq, <Input as StreamOnce>::Range: PartialEq,

source§

fn easy_parse( &mut self, input: Input ) -> Result<(<Self as Parser<Stream<Input>>>::Output, Input), ParseError<Input>>
where Input: Stream, Stream<Input>: StreamOnce<Token = Input::Token, Range = Input::Range, Error = ParseError<Stream<Input>>, Position = Input::Position>, Input::Position: Default, Self: Sized + Parser<Stream<Input>>,

Available on crate feature std only.
Entry point of the parser. Takes some input and tries to parse it, returning an easy to use and format error if parsing did not succeed. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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

§

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> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more