-
Notifications
You must be signed in to change notification settings - Fork 52
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
Use Display in trace or forward Debug in Located, Stateful and Recoverable #482
Comments
Not all streams implement Alternatively, we could change the |
Perhaps we could define a custom |
Since most people don't implement a custom stream, a new trait is likely fine. The main question about how we should handle custom tokens. Right now, you can its pretty minimal to support those (see custom token docs) and this gets into slices vs tokes. Maybe we could just use debug alternate on tokens. This would be a breaking change still. For now, I've gone forward with the workaround I mentioned |
I wonder if you could instead have This would look something like trait Stream: core::fmt::Debug {
...
fn fmt_remaining(&self, f: &mut core::fmt::Formatter<'_>) {
core::fmt::Debug::fmt(self, f)
}
} This way, adaptor streams like It also means that we can remove the use of |
Was looking at making changes for this but I can't reproduce the original problem #!/usr/bin/env nargo
---
package.edition = "2021"
[dependencies]
winnow.version = "=0.6.2"
winnow.features = ["debug"]
---
use winnow::prelude::*;
fn main() {
let input = "5";
let mut input = winnow::stream::Located::new(input);
winnow::ascii::digit1::<_, ()>.parse_next(&mut input).unwrap();
}
Even if I roll back to 0.4 I don't see it #!/usr/bin/env nargo
---
package.edition = "2021"
[dependencies]
winnow.version = "0.4"
winnow.features = ["debug"]
---
use winnow::prelude::*;
fn main() {
let input = "5";
let input = winnow::stream::Located::new(input);
winnow::ascii::digit1::<_, ()>.parse_next(input).unwrap();
} |
This reverts commit 680b41a. PR winnow-rs#514 was meant to help winnow-rs#482 but I can't reproduce the problem
I have a tracing change posted in #661 but I'm trying to decide if it fills the right needs and will help enough. Feedback would be appreciated! |
I realized that a good reason to move forward is so that |
Except we don't implement |
Please complete the following tasks
winnow version
0.6.2
Describe your use case
I want to use
winnow/debug
but the output looks like this:Also, the
separated
assert looks like this but it isn't as much of an issue:Describe the solution you'd like
winnow/src/combinator/debug/internals.rs
Line 149 in df311c1
OR do the following for Located, Stateful and Recoverable
winnow/src/stream/mod.rs
Line 109 in df311c1
Alternatives, if applicable
Make a new trait to display in trace to avoid breaking
Debug
for other use cases.Additional Context
The text was updated successfully, but these errors were encountered: