| Crates.io | pokeapi-macro |
| lib.rs | pokeapi-macro |
| version | 1.1.4 |
| created_at | 2021-10-18 03:26:34.077802+00 |
| updated_at | 2022-03-26 19:31:27.699834+00 |
| description | Attribute macros for `pokeapi-model`. |
| homepage | |
| repository | https://github.com/tedbyron/dex/tree/main/pokeapi-macro |
| max_upload_size | |
| id | 466524 |
| size | 6,329 |
pokeapi-macro
Attribute macro for pokeapi-model.
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>
}