pokeapi-macro

Crates.iopokeapi-macro
lib.rspokeapi-macro
version1.1.4
sourcesrc
created_at2021-10-18 03:26:34.077802
updated_at2022-03-26 19:31:27.699834
descriptionAttribute macros for `pokeapi-model`.
homepage
repositoryhttps://github.com/tedbyron/dex/tree/main/pokeapi-macro
max_upload_size
id466524
size6,329
Teddy Byron (tedbyron)

documentation

https://docs.rs/pokeapi-macro

README

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>
}
Commit count: 0

cargo fmt