Struct kalosm_sample::StringParser
source · pub struct StringParser<F: Fn(char) -> bool + 'static = fn(_: char) -> bool> { /* private fields */ }
Expand description
A parser for an ascii string.
Implementations§
source§impl StringParser<fn(_: char) -> bool>
impl StringParser<fn(_: char) -> bool>
sourcepub fn new(len_range: RangeInclusive<usize>) -> Self
pub fn new(len_range: RangeInclusive<usize>) -> Self
Create a new string parser.
source§impl<F: Fn(char) -> bool + 'static> StringParser<F>
impl<F: Fn(char) -> bool + 'static> StringParser<F>
sourcepub fn with_allowed_characters<F2: Fn(char) -> bool + 'static>(
self,
character_filter: F2
) -> StringParser<F2>
pub fn with_allowed_characters<F2: Fn(char) -> bool + 'static>( self, character_filter: F2 ) -> StringParser<F2>
Only allow characters that pass the filter.
Trait Implementations§
source§impl<F: Clone + Fn(char) -> bool + 'static> Clone for StringParser<F>
impl<F: Clone + Fn(char) -> bool + 'static> Clone for StringParser<F>
source§fn clone(&self) -> StringParser<F>
fn clone(&self) -> StringParser<F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl CreateParserState for StringParser<fn(_: char) -> bool>
impl CreateParserState for StringParser<fn(_: char) -> bool>
source§fn create_parser_state(&self) -> <Self as Parser>::PartialState
fn create_parser_state(&self) -> <Self as Parser>::PartialState
Create the default state of the parser.
source§impl<F: Fn(char) -> bool + 'static> Parser for StringParser<F>
impl<F: Fn(char) -> bool + 'static> Parser for StringParser<F>
§type Error = StringParseError
type Error = StringParseError
The error type of the parser.
§type PartialState = StringParserState
type PartialState = StringParserState
The state of the parser.
source§fn parse<'a>(
&self,
state: &StringParserState,
input: &'a [u8]
) -> Result<ParseResult<'a, Self::PartialState, Self::Output>, Self::Error>
fn parse<'a>( &self, state: &StringParserState, input: &'a [u8] ) -> Result<ParseResult<'a, Self::PartialState, Self::Output>, Self::Error>
Parse the given input.
source§impl<F: PartialEq + Fn(char) -> bool + 'static> PartialEq for StringParser<F>
impl<F: PartialEq + Fn(char) -> bool + 'static> PartialEq for StringParser<F>
source§fn eq(&self, other: &StringParser<F>) -> bool
fn eq(&self, other: &StringParser<F>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<F: Eq + Fn(char) -> bool + 'static> Eq for StringParser<F>
impl<F: Fn(char) -> bool + 'static> StructuralPartialEq for StringParser<F>
Auto Trait Implementations§
impl<F> RefUnwindSafe for StringParser<F>where
F: RefUnwindSafe,
impl<F> Send for StringParser<F>where
F: Send,
impl<F> Sync for StringParser<F>where
F: Sync,
impl<F> Unpin for StringParser<F>where
F: Unpin,
impl<F> UnwindSafe for StringParser<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<P> ParserExt for Pwhere
P: Parser,
impl<P> ParserExt for Pwhere
P: Parser,
source§fn or<V: Parser<Error = E, Output = O, PartialState = PA>, E, O, PA>(
self,
other: V
) -> ChoiceParser<Self, V>where
Self: Sized,
fn or<V: Parser<Error = E, Output = O, PartialState = PA>, E, O, PA>(
self,
other: V
) -> ChoiceParser<Self, V>where
Self: Sized,
Parse this parser, or another other parser.
source§fn then<V: Parser<Error = E, Output = O, PartialState = PA>, E, O, PA>(
self,
other: V
) -> SequenceParser<Self, V>where
Self: Sized,
fn then<V: Parser<Error = E, Output = O, PartialState = PA>, E, O, PA>(
self,
other: V
) -> SequenceParser<Self, V>where
Self: Sized,
Parse this parser, then the other parser.
source§fn repeat(self, length_range: RangeInclusive<usize>) -> RepeatParser<Self>where
Self: Sized,
fn repeat(self, length_range: RangeInclusive<usize>) -> RepeatParser<Self>where
Self: Sized,
Repeat this parser a number of times.
source§fn map_output<F: Fn(Self::Output) -> O, O>(
self,
f: F
) -> MapOutputParser<Self, F, O>where
Self: Sized,
fn map_output<F: Fn(Self::Output) -> O, O>(
self,
f: F
) -> MapOutputParser<Self, F, O>where
Self: Sized,
Map the output of this parser.