When I use the Serialize macro of serde I use the Macro and Trait together so I don't need to import the trait additional.
#[serde::Serialize)]
struct Abc {
a: 4
}
How does it work? When I try to implement this, I can't find a working solution and I can't find something about this in the internet.
Here is a snippet, what I found in the serde logic to get this functionality
pub mod traits;
pub use traits::Example;
#[cfg(feature = "lib_derive")]
#[macro_use]
extern crate lib_derive;
#[cfg(feature = "lib_derive")]
pub use lib_derive::Example;
In this case the compiler throws an error with the note: this error originates in the derive macro 'lib::Example'
, so it didn't find the Trait, but in the serde crate it works.
What did I miss here?