# Function nom::combinator::complete

source · [−]

    pub fn complete<I: Clone, O, E: ParseError<I>, F>(
        f: F
    ) -> impl FnMut(I) -> IResult<I, O, E> where
        F: Parser<I, O, E>,

Expand description

Transforms Incomplete into `Error`.

    use nom::bytes::streaming::take;
    use nom::combinator::complete;

    let mut parser = complete(take(5u8));

    assert_eq!(parser("abcdefg"), Ok(("fg", "abcde")));
    assert_eq!(parser("abcd"), Err(Err::Error(("abcd", ErrorKind::Complete))));