Struct kalosm_sample::I32Parser

source ·
pub struct I32Parser { /* private fields */ }
Expand description

A parser for i32.

Implementations§

source§

impl I32Parser

source

pub fn new() -> Self

Create a new parser.

source

pub fn with_range(self, range: RangeInclusive<i32>) -> Self

Set the range of the integers that this parser can parse.

Trait Implementations§

source§

impl Clone for I32Parser

source§

fn clone(&self) -> I32Parser

Returns a copy 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 CreateParserState for I32Parser

source§

fn create_parser_state(&self) -> <Self as Parser>::PartialState

Create the default state of the parser.
source§

impl Debug for I32Parser

source§

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

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

impl Default for I32Parser

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Parser for I32Parser

§

type Output = i32

The output of the parser.
§

type PartialState = <IntegerParser as Parser>::PartialState

The state of the parser.
source§

fn parse<'a>( &self, state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Parse the given input.

Auto Trait Implementations§

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ParserExt for P
where P: Parser,

source§

fn otherwise<V: Parser>(self, other: V) -> ChoiceParser<Self, V>
where Self: Sized,

Parse this parser, or another other parser.
source§

fn or<V: Parser<Output = Self::Output>>( self, other: V, ) -> MapOutputParser<ChoiceParser<Self, V>, Self::Output>
where Self: Sized,

Parse this parser, or another other parser with the same type
source§

fn then<V: Parser>(self, other: V) -> SequenceParser<Self, V>
where Self: Sized,

Parse this parser, then the other parser.
source§

fn then_lazy<V, F>(self, other: F) -> ThenLazy<Self, F>
where Self: Sized, V: CreateParserState, F: Fn(&Self::Output) -> V,

Parse this parser, then the other parser that is created base on the output of this parser.
source§

fn ignore_output_then<V: CreateParserState>( self, other: V, ) -> MapOutputParser<SequenceParser<Self, V>, <V as Parser>::Output>
where Self: Sized,

Parse this parser, then the other parser while ignoring the current parser’s output.
source§

fn then_ignore_output<V: CreateParserState>( self, other: V, ) -> MapOutputParser<SequenceParser<Self, V>, <Self as Parser>::Output>
where Self: Sized,

Parse this parser, then the other parser while ignoring the output of the other parser.
source§

fn then_literal( self, literal: impl Into<Cow<'static, str>>, ) -> MapOutputParser<SequenceParser<Self, LiteralParser>, <Self as Parser>::Output>
where Self: Sized,

Parse this parser, then a literal. This is equivalent to .then_ignore_output(LiteralParser::new(literal)).
source§

fn repeat(self, length_range: RangeInclusive<usize>) -> RepeatParser<Self>
where Self: Sized,

Repeat this parser a number of times.
source§

fn map_output<F, O>(self, f: F) -> MapOutputParser<Self, O, F>
where Self: Sized, F: Fn(Self::Output) -> O,

Map the output of this parser.
source§

fn boxed(self) -> ArcParser<Self::Output>
where Self: CreateParserState + Sized + Send + Sync + 'static, Self::Output: Send + Sync + 'static, Self::PartialState: Send + Sync + 'static,

Get a boxed version of this parser.
source§

fn with_initial_state<F: Fn() -> Self::PartialState + Clone>( self, initial_state: F, ) -> WithInitialState<Self, F>
where Self: Sized,

Create a new parser with a different initial state
source§

impl<T> ToOwned for T
where T: Clone,

§

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

§

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<P> SendCreateParserState for P
where P: CreateParserState + Send + Sync, <P as Parser>::PartialState: Send + Sync, <P as Parser>::Output: Send + Sync,