[][src]Trait nom::InputTakeAtPosition

pub trait InputTakeAtPosition: Sized {
    type Item;
    pub fn split_at_position<P, E: ParseError<Self>>(
        &self,
        predicate: P
    ) -> IResult<Self, Self, E>
    where
        P: Fn(Self::Item) -> bool
;
pub fn split_at_position1<P, E: ParseError<Self>>(
        &self,
        predicate: P,
        e: ErrorKind
    ) -> IResult<Self, Self, E>
    where
        P: Fn(Self::Item) -> bool
;
pub fn split_at_position_complete<P, E: ParseError<Self>>(
        &self,
        predicate: P
    ) -> IResult<Self, Self, E>
    where
        P: Fn(Self::Item) -> bool
;
pub fn split_at_position1_complete<P, E: ParseError<Self>>(
        &self,
        predicate: P,
        e: ErrorKind
    ) -> IResult<Self, Self, E>
    where
        P: Fn(Self::Item) -> bool
; }

Methods to take as much input as possible until the provided function returns true for the current element.

A large part of nom's basic parsers are built using this trait.

Associated Types

type Item[src]

The current input type is a sequence of that Item type.

Example: u8 for &[u8] or char for &str

Loading content...

Required methods

pub fn split_at_position<P, E: ParseError<Self>>(
    &self,
    predicate: P
) -> IResult<Self, Self, E> where
    P: Fn(Self::Item) -> bool
[src]

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position.

streaming version: If no element is found matching the condition, this will return Incomplete

pub fn split_at_position1<P, E: ParseError<Self>>(
    &self,
    predicate: P,
    e: ErrorKind
) -> IResult<Self, Self, E> where
    P: Fn(Self::Item) -> bool
[src]

Looks for the first element of the input type for which the condition returns true and returns the input up to this position.

Fails if the produced slice is empty.

streaming version: If no element is found matching the condition, this will return Incomplete

pub fn split_at_position_complete<P, E: ParseError<Self>>(
    &self,
    predicate: P
) -> IResult<Self, Self, E> where
    P: Fn(Self::Item) -> bool
[src]

Looks for the first element of the input type for which the condition returns true, and returns the input up to this position.

complete version: If no element is found matching the condition, this will return the whole input

pub fn split_at_position1_complete<P, E: ParseError<Self>>(
    &self,
    predicate: P,
    e: ErrorKind
) -> IResult<Self, Self, E> where
    P: Fn(Self::Item) -> bool
[src]

Looks for the first element of the input type for which the condition returns true and returns the input up to this position.

Fails if the produced slice is empty.

complete version: If no element is found matching the condition, this will return the whole input

Loading content...

Implementations on Foreign Types

impl<'a> InputTakeAtPosition for &'a [u8][src]

type Item = u8

impl<'a> InputTakeAtPosition for &'a str[src]

type Item = char

impl<'a, O, T> InputTakeAtPosition for &'a BitSlice<O, T> where
    O: BitOrder,
    T: 'a + BitStore
[src]

type Item = bool

Loading content...

Implementors

impl<T: InputLength + InputIter + InputTake + Clone + UnspecializedInput> InputTakeAtPosition for T[src]

type Item = <T as InputIter>::Item

Loading content...