Attribute Macro pokeapi_macro::pokeapi_struct [−][src]
#[pokeapi_struct]Expand description
Attribute macro to generate a PokéAPI struct.
Panics
Panics if the passed item is not a valid struct.
Examples
ⓘ
// Consider the following example:
use pokeapi_macro::pokeapi_struct;
#[pokeapi_struct]
struct NamedAPIResource {
description: String,
url: String,
}
// This attribute will output the `struct` with required derived traits and
// visibility:
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NamedAPIResource {
pub description: String,
pub url: String,
}