Crates.io | cocoa-purity |
lib.rs | cocoa-purity |
version | 0.1.1 |
source | src |
created_at | 2023-04-28 20:56:55.913264 |
updated_at | 2023-04-28 20:58:42.745292 |
description | Simple macro collection |
homepage | |
repository | https://github.com/nerodono/cocoa-purity |
max_upload_size | |
id | 851704 |
size | 9,236 |
cocoa-purity is a collection of the useful procedural macros.
P.S. named after the beautiful cat Cocoa
use cocoa_purity::map_enum;
#[derive(Debug)]
pub enum Quirk {
AbilityToSleep,
Nothing,
}
#[map_enum(Quirk)]
pub enum Character {
Nero = AbilityToSleep,
Custom { name: &'static str } = Nothing
}
let nero = Character::Nero;
let custom = Character::Custom { name: "Friend" };
let nero_quirk: Quirk = nero.into();
let custom_quirk: Quirk = custom.into();
dbg!(nero_quirk, custom_quirk);