Respect fmt trait and flags in Value #400
No reviewers
Labels
No labels
bug
duplicate
easy
enhancement
help wanted
invalid
question
rfc
structured-logging
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-rust-lang/log!400
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/value-fmt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #395
This PR makes the
fmt::Debugandfmt::Displayimpls onValuerespect the trait being used and any flags present. I've added a separate visitor forDisplaythat uses the right trait, and pass the value directly to the formatter instead of going throughformat_args.There are some extra tests for formatting and I've shifted a few pieces around to be consistent.
Tests won't pass until I fix https://github.com/sval-rs/sval/issues/84 as well.r? @yoshuawuyts
This doesn't pass yet.
@ -194,0 +198,4 @@impl sval::Value for TestSval {fn stream(&self, stream: &mut sval::value::Stream) -> sval::value::Result {stream.u64(42)Just moved up into the
implblock, like the visitors in thefmtmodule.@ -73,4 +70,1 @@io::Error::new(io::ErrorKind::Other, err)}}}We removed a similar external
Fromimpl in #398 that was causing problems with inference.💯 -- thanks heaps!