feat(multi): Switch from Vec to impl Accumulate #127
Merged
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.
I went with a custom trait so we could cover
()
andusize
as well assupport custom capacities.
This comes at the cost of supporting any container possible. We could
possibly do that with a
Extendable(T: Default + Extend)
newtype.As an alternative to
()
andusize
is GATs. The main difference iswho drives the types.
This allowed us to deprecate
many[01]_count
.Along the way, we also updated
escaped_transform
to this so we use this consistently. This exposed why #19 was broken.ExtendInto
was implemented both for input and for outputs for the two parsers, which was meant to includechar
. The backward design of the trait made this less obvious what was happening which I feel is a win for the new trait design.However, now that
Accumulate
has noinput
connection, there isn't quite a proper home for this...I am conflicted about needing to annotate types when passing a
many
into something that ignores the output, likerecognize
. In some respects, I want to require the output type into parsers likerecognize
to be()
but that that will require a lot ofvoid()
as that is the minority case. This is a benefit to the GAT approach.Fixes #122
BREAKING CHANGE: The trait and behavior for
escaped_transform
changed due to replacingExtendInto
withAccumulate
.