-
Notifications
You must be signed in to change notification settings - Fork 44
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
Lazy context #605
Comments
Could you share your error type and context type? |
I'm using #[derive(Debug, Clone)]
pub enum ParseContext {
Description(Cow<'static, str>),
Expected(Cow<'static, str>),
} |
I'm confused by the example because you don't pass a |
Yeah, sorry, to be clear I mean a method which computes multiple contexts up-front.
You're right, thank you. I've looked at the code a bit more. But the Lines 646 to 660 in 8674ed2
Maybe I'm just holding it wrong? Not sure. |
It would help if you gave a more complete example of what you are trying to accomplish. |
Please complete the following tasks
winnow version
master
Describe your use case
I'd like to add context to parsers without immediately allocating a
Vec
for themDescribe the solution you'd like
Would it be possible to have a
.context_from(|| vec!["context1", "context2"])
function which only computes the context on error branches? Ideally this would be a middle-ground for performance between allocating the contexts up-front and omitting them entirely.Alternatives, if applicable
Not sure! I'm interested to hear discussion.
Additional Context
See #421.
The text was updated successfully, but these errors were encountered: