Allow ()
to be used as error type for nom::bits::{bits,bytes}
#1583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For most parsers, you can use the unit type as the error type, which is useful if you don't actually care about the details of a parse error, only that it's failed.
However, when using
nom::bits::bits
andnom::bits::bytes
, two error types are required: one for byte-based errors, and one for bit-based errors. Further, the error type has to conform toErrorConvert
, to allow bit-based errors to be converted to byte-based errors (fornom::bits::bits
) and vice versa (fornom::bits::bytes
).This branch makes the unit type conform to
ErrorConvert
with a trivial implementation, to enable it to be used as both error types fornom::bits::bits
andnom::bits::bytes
.