Skip to content
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

Emitting serde_spanned from other crates (formats) #634

Open
Kixunil opened this issue Oct 24, 2023 · 2 comments · May be fixed by #635
Open

Emitting serde_spanned from other crates (formats) #634

Kixunil opened this issue Oct 24, 2023 · 2 comments · May be fixed by #635
Labels
A-serde Area: Serde integration C-enhancement Category: Raise on the bar on expectations

Comments

@Kixunil
Copy link

Kixunil commented Oct 24, 2023

I'd like to be able to emit Spanned in rfc822-like. I think an API like this could work:

impl<''de> Deserializer<'de> for MyDeserializer {
    // ...
    fn deserialize_struct<V: Visitor<'de>>(name: &'static str, fields: &'static [&'static str], visitor: V) -> Result<V::Value, Self::Error> {
        if serde_spanned::is_spanned(name, fields) {
            serde_spanned::emit_spanned(self, self.span)
        } else {
            // normal deserialization here
        }
    }
}
@epage epage linked a pull request Oct 24, 2023 that will close this issue
@epage
Copy link
Member

epage commented Oct 24, 2023

Could you try patching in #635 and seeing if it works for you?

epage added a commit to epage/toml_edit that referenced this issue Oct 24, 2023
epage added a commit to epage/toml_edit that referenced this issue Oct 24, 2023
@Kixunil
Copy link
Author

Kixunil commented Oct 24, 2023

Thanks for quick response! I don't expect to be able to do it very soon but will try not to lag too much.

@epage epage added C-enhancement Category: Raise on the bar on expectations A-serde Area: Serde integration labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-serde Area: Serde integration C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants