Trait ParseFrom

Source
pub trait ParseFrom<I, E = Error<I>>
where Self: Sized,
{ // Required method fn parse(input: I) -> IResult<I, Self, E>; }
Expand description

A trait for types that can be parsed from the given input.

Required Methods§

Source

fn parse(input: I) -> IResult<I, Self, E>

A function that can act as a nom Parser type that parses some of the input and returns an instance of this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for bool
where I: Input + Compare<&'static str>,

Support reading the words “true” or “false” from the input and interpreting them as boolean values.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for char
where I: Input, <I as Input>::Item: AsChar,

Support reading a single character from the input.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for f32
where I: Input + Offset + AsBytes + Compare<&'static str> + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar, <I as Input>::Iter: Clone,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for f64
where I: Input + Offset + AsBytes + Compare<&'static str> + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar, <I as Input>::Iter: Clone,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for i8
where I: Input + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for i16
where I: Input + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for i32
where I: Input + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for i64
where I: Input + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for i128
where I: Input + for<'a> Compare<&'a [u8]>, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for u8
where I: Input, <I as Input>::Item: AsChar,

Support reading a single byte from the input. This is NOT a parsed number, but the raw byte value.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for u16
where I: Input, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for u32
where I: Input, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for u64
where I: Input, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>> ParseFrom<I, E> for u128
where I: Input, <I as Input>::Item: AsChar,

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>, K, V: ParseFrom<I, E>, S> ParseFrom<I, E> for HashMap<K, V, S>
where I: Input + Compare<&'static str>, <I as Input>::Item: AsChar + Copy, K: Eq + Hash + ParseFrom<I, E>, S: BuildHasher + Default,

Support parsing a HashMap of ParseFrom types from the input. This uses the line_ending parser to separate the items and the “=” sign to separate the key and value.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>, T, S> ParseFrom<I, E> for HashSet<T, S>
where I: Input + Compare<&'static str>, T: Eq + Hash + ParseFrom<I, E>, S: BuildHasher + Default,

Support parsing a HashSet of ParseFrom types from the input. This uses the line_ending parser to separate the items.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Source§

impl<I, E: ParseError<I>, T: ParseFrom<I, E>> ParseFrom<I, E> for Vec<T>
where I: Input + Compare<&'static str>,

Support parsing a vector of ParseFrom types from the input. This uses the line_ending parser to separate the items.

Source§

fn parse(input: I) -> IResult<I, Self, E>

Implementors§