Since we cannot implement `From` on `nom::Err` because of conflicting
implementations, we will have an `into` combinator to make it easier to
convert between error types
There's no particular reason why empty elements shouldn't be allowed in
the separated_list[0|1] macros and functions. It's useful to be able to
parse things like CSV ",,,foo".
An empty separator is still not allowed.
This change includes test coverage of both cases.
Use safe version of turning u32 into char because the input might
contain surrogates.
This only fixes a symptom and not the underlying issue that surrogates
are not handled at the moment.
If they didn't have enough input data, these two functions were
returning a `Needed` value reflecting the entire expected length, not
the length remaining after the available input.
As a result, a caller that blocks until the specified number of bytes
are available could get stuck waiting forever.
I've fixed the affected tests at the same time as fixing this bug. For
most of them I made sure the tests would detect this error. But for
`tests/overflow.rs`, I deleted the partial input after the length
instead (meaning the tests pass either way), because I don't think it
matters for the purposes of checking if the parsers have an unsigned
overflow.
even if they do not make sense (there's no endianness to care for on a
single byte), importing the new functions is annoying (`use
nom::number::comlete::u8` conflicting, etc), and it will be consistent
with other byte sizes
The trait implementations permit `bitvec` types to be used directly
within the `bytes` parsers, as demonstrated by the `tests/bitstream`
module using `bytes::tag` to process a bitstream.
This unification allows the removal of the `bits` module in favor of
ordinary combinators written to be generic over a consumable input
type.