Skip to content

Support TermId (de)serialization to/from sequences#72

Merged
ielis merged 1 commit into
developmentfrom
support-serde-for-sequences
Jul 9, 2026
Merged

Support TermId (de)serialization to/from sequences#72
ielis merged 1 commit into
developmentfrom
support-serde-for-sequences

Conversation

@ielis

@ielis ielis commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Allow TermId (de)serialization to/from Ts that implement IntoIterator<TermId> or FromIterator<TermId>.

For instance, a Feature with an iterable field, such as alt_term_ids, can now be serialized:

#[derive(PartialEq, Debug, serde::Serialize, serde::Deserialize)]
struct Feature {
    #[serde(
        serialize_with = "TermId::serialize_as_curie",
        deserialize_with = "TermId::deserialize_from_curie"
    )]
    term_id: TermId,

    #[serde(
        serialize_with = "TermId::serialize_as_curie_seq",
        deserialize_with = "TermId::deserialize_from_curie_seq"
    )]
    alt_term_ids: Vec<TermId>,
}

@ielis
ielis merged commit a2d85d7 into development Jul 9, 2026
5 checks passed
@ielis
ielis deleted the support-serde-for-sequences branch July 9, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant