Crate pokeapi_macro
source · [−]Expand description
pokeapi-macro
Attribute macro for pokeapi-model
.
Usage
Consider the following example:
use pokeapi_macro::pokeapi_struct;
#[pokeapi_struct]
struct NamedAPIResource<T> {
description: String,
url: String,
_resource_type: std::marker::PhantomData<*const T>,
}
This attribute will output the struct
with required derived traits and visibility:
#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub struct NamedAPIResource<T> {
pub description: String,
pub url: String,
#[serde(skip)]
_resource_type: std::marker::PhantomData<*const T>
}
Attribute Macros
Attribute macro that generate a pokeapi-model
struct.