You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 9, 2023. It is now read-only.
There is currently no simple way to make a boxed trait object deserializable via an internal tag that determines its concrete type. I would like to be able to express trait objects as:
#[serde_trait_object]traitMyTrait{/* whatever trait methods */}structA{a:u8,}#[serde_trait_object]implMyTraitforA{}// possibly in a different cratestructB{b:u8,}#[serde_trait_object]implMyTraitforB{}
The attribute macro would insert whatever supertraits and trait methods are necessary to make this work, probably using erased-serde for the object safety and inventory for a registry of all trait implementations compiled into the program.
If more than one deserializable type in the program has the same name, the deserialization should error at runtime and recommend renaming one of the types or using a #[serde(rename = "...")] attribute to make its tag unique.
The text was updated successfully, but these errors were encountered:
There is currently no simple way to make a boxed trait object deserializable via an internal tag that determines its concrete type. I would like to be able to express trait objects as:
The attribute macro would insert whatever supertraits and trait methods are necessary to make this work, probably using
erased-serde
for the object safety andinventory
for a registry of all trait implementations compiled into the program.The serialized form of these types should carry a type tag, similar to what you might see with polymorphic deserialization using Jackson in Java.
If more than one deserializable type in the program has the same name, the deserialization should error at runtime and recommend renaming one of the types or using a
#[serde(rename = "...")]
attribute to make its tag unique.The text was updated successfully, but these errors were encountered: