Skip to content

Emitting serde_spanned from other crates (formats) #634

Open
@Kixunil

Description

@Kixunil

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
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-serdeArea: Serde integrationC-enhancementCategory: Raise on the bar on expectations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions