I have imported serde for using the bincode crate, But the compiler is treating the Deserialize/Serialize
macros like they do not exist.
Here is the code:
use serde::Serialize;
use serde::Deserialize;
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Debug)]
struct Tile {
id: usize,
durability: u8,
}
And here is the error:
error: cannot find derive macro `Serialize` in this scope
--> src/main.rs:35:23
|
35 | #[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Debug)]
| ^^^^^^^^^
|
note: `Serialize` is imported here, but it is only a trait, without a derive macro
--> src/main.rs:16:5
|
16 | use serde::Serialize;
| ^^^^^^^^^^^^^^^^
error: cannot find derive macro `Deserialize` in this scope
--> src/main.rs:35:34
|
35 | #[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Debug)]
| ^^^^^^^^^^^
|
note: `Deserialize` is imported here, but it is only a trait, without a derive macro
I have tried importing the macros using use serde::macros::*;
, But it's a private module, So I cannot use it.