Function take
fn take<C, I, Error: ParseError<I>>(count: C) -> impl FnMut(I) -> crate::internal::IResult<I, I, Error>
where
I: Input,
C: ToUsize
Returns an input slice containing the first N input elements (Input[..N]).
It will return Err(Err::Error((_, ErrorKind::Eof))) if the input is shorter than the argument.
Example
# use ;
use take;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
The units that are taken will depend on the input type. For example, for a
&str it will take a number of char's, whereas for a &[u8] it will
take that many u8's:
use Error;
use take;
assert_eq!;
assert_eq!;