Rust provides a Serialize
and Deserialize
macro which are applied by decorating the struct you're defining with #[derive(Serialize)]
and #[derive(Deserialize)]
. How do I apply these macros if I'm not defining the struct? Like let's say I have,
use foo::Bar;
And Bar
is a struct. How can I make it such that the Bar struct can be serialized and deserialized from within Actix? You can't apply the Serialize macro to use statements or you'll get,
error[E0774]: `derive` may only be applied to structs, enums and unions