#[pokeapi_struct]
Expand description

Attribute macro that generate a pokeapi-model 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<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>
}