Stream: wit-bindgen

Topic: additional_derives: resource in variants or records


view this post on Zulip Colin D Murphy (Mar 07 2025 at 20:01):

The worlds defined in my wit file contain uses variants with resources which causes wit-bindgen to fail if I use additional_derives: [serde::Deserialize].
Would either of these ideas be acceptable? We allow the user to specify records/variants to ignore, or we could confine the additional_derives to specific interfaces.

additional_derives: {
traits: [serde::Serialize, serde::Deserialize, Hash, Clone, PartialEq, Eq],
ignore: [input-stream]
}

or

additional_derives: {
traits: [serde::Serialize, serde::Deserialize, Hash, Clone, PartialEq, Eq],
interface: "adobe:cai/types@0.1.0",
}
WASI P2 component for C2PA. Contribute to cdmurph32/c2pa-component development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Mar 07 2025 at 20:40):

That seems like a reasonable extension to me yeah, I'm not sure how exactly to encode this in the macro configuration or CLI but regardless I thnk it's a reasonable feature to have one way or another

view this post on Zulip Colin D Murphy (Mar 07 2025 at 20:47):

I don't know how many people are using it, but the change could be backwards compatible:

additional_derives: [serde::Serialize, serde::Deserialize, Hash, Clone, PartialEq, Eq],
additional_derives_ignore: [input-stream],
}

or

additional_derives: [serde::Serialize, serde::Deserialize, Hash, Clone, PartialEq, Eq],
additional_derives_interface: "adobe:cai/types@0.1.0",
}

view this post on Zulip Alex Crichton (Mar 07 2025 at 20:50):

both seem reasonable enough to me yeah

view this post on Zulip Colin D Murphy (Mar 10 2025 at 16:37):

PR opened: feat: Allow variants and records to be ignored by additional_derives

This feature allows some variants and records to use types for which adding traits will cause compilation to fail, such as serde::Deserialize on wasi:io/streams. Variants and records are specified ...

Last updated: Apr 08 2025 at 02:30 UTC