-
-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Winnow 0.7 #1822
Upgrade to Winnow 0.7 #1822
Conversation
This is a trait alias to smooth out the Winnow 0.7 upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your tremendous help with winnow
updates, it's much appreciated!
It seems using winnow::Result
is lighter as it doesn't include ErrMode
, so it might be good for performance improvements. For now I don't know what that would do to the error output, but it seems that can be maintained as is.
Additionally I have left a comment with a question on how to improve a particular piece of code, hoping you find the time to take a look.
Thanks again.
&start, | ||
StrContext::Label("Closing '>' not found"), | ||
)))?; | ||
let right_delim_idx = i[..eol_idx] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was introduced in #1439 and I wonder if this there isn't an 'packagiomatic' way of writing this. This code implements the parser by hand, but that was done merely due to lack of knowledge on how to use winnow
primitives.
Is there anything that could be done to make it nicer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main challenge is the rfind
, right? I've not thought of a good way to handle cases like that.
If its parsing within the \n
delimited range, there is and_then
, like take_until(0.., b'\n').and_then(parser)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's the rfind()
to assure it finds the right-most >
as delimiter, within the line boundary.
I happened to look into this patch and would like to share some thoughts on
Back to the reason I jump into this patch: this is the final winnow 0.6 dependency in the tree of my application, so I'd expect a new release to eliminate that :D |
I do see it less likely that gitoxide will need |
Oh, #1439 added |
FYI as this doesn't use
cut_err
orPartial
, you could switch away fromErrMode
for some potential simplification and performance improvements.I think it should just be
ErrMode
ModalParser
toParser
ModalResult
towinnow::Result
However, it'd be harder to undo it (picking apart which
Result
s need to beModalResult
s) so I held off on it from this PR