dtolnay / serde-ignored

Find out about keys that are ignored when deserializing data
Apache License 2.0
74 stars 7 forks source link

Line/column numbers? #11

Open Diggsey opened 3 years ago

Diggsey commented 3 years ago

Is there any way to get the spans of the ignored keys?

The only way I can think of doing this right now would be to copy what this crate does, but instead of creating a Path, try to deserialize a toml::Spanned<toml::Value> at the ignored key.

gilescope commented 3 years ago

I'm trying to get toml::Spanned and serde_ignored to work nicely together at the moment. I keep getting it fail saying it expects "a borrowed string" when deserialising cargo tomls: dependencies: Option<BTreeMap<String, Spanned<TomlDependency>>>,.

The SpannedVisitor delegate chain seems to get broken in serde here: deserializer.deserialize_str(StrVisitor). It's a bit hard to see what's going on but I think CaptureKey is maybe where things are going pair shaped.