Function length_take
fn length_take<Input, Count, Error, CountParser>(count: CountParser) -> impl Parser<Input, <Input as Stream>::Slice, Error>
where
Input: StreamIsPartial + Stream,
Count: ToUsize,
CountParser: Parser<Input, Count, Error>,
Error: ParserError<Input>
Get a length-prefixed slice (TLV)
To apply a parser to the returned slice, see length_and_then.
If the count is for something besides tokens, see length_repeat.
Complete version: Returns an error if there is not enough input data.
[Partial version][crate::_topic::partial]: Will return Err(winnow::error::ErrMode::Incomplete(_)) if there is not enough data.
Example
# use ;
# use *;
use Bytes;
use be_u16;
use length_take;
type Stream<'i> = ;
assert_eq!;
assert_eq!;