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
As described in the post above, user-defined types that include an Arc<File> field can't be deserialized. The workaround is to deserialize the path and hold File(s) in a container to prevent it from being dropped.
In the serde documentation https://serde.rs/data-model.html#types, serde supports many types, but the limitation seems to be that the types must be convertible or contain primitive types. Not all types need to be serialized to/deserialized from bytes. In my case, it just needs to serialize/deserialize to a DOM, where some types just need to be cloned to the target. I think this satisfies Serialize/Deserialize, just not SerializeToBytes/DeserializeFromBytes.
Would this use case be considered?
The text was updated successfully, but these errors were encountered:
cpunion
changed the title
Deserialize user-defined types including resource
[Suggest] Deserialize user-defined types including resource
Dec 28, 2024
I have asked a question on the Rust Discord forum How to deserialize a custom type containing
Arc<File>
from a generic parameter?, and I've completed a crate https://github.com/cpunion/axum-params. It works, but could be improved.As described in the post above, user-defined types that include an
Arc<File>
field can't be deserialized. The workaround is to deserialize the path and hold File(s) in a container to prevent it from being dropped.In the serde documentation https://serde.rs/data-model.html#types, serde supports many types, but the limitation seems to be that the types must be convertible or contain primitive types. Not all types need to be serialized to/deserialized from bytes. In my case, it just needs to serialize/deserialize to a DOM, where some types just need to be cloned to the target. I think this satisfies
Serialize
/Deserialize
, just notSerializeToBytes
/DeserializeFromBytes
.Would this use case be considered?
The text was updated successfully, but these errors were encountered: