Macro activitystreams_kinds::kind
source · [−]macro_rules! kind {
($x:ident, $y:ident) => { ... };
}
Expand description
Generate an enum implementing serde’s Serialize and Deserialize with a single variant
This is useful for describing constants
use activitystreams_kinds::kind;
kind!(CustomType, Custom);
#[derive(serde::Deserialize)]
struct MyStruct {
#[serde(rename = "type")]
kind: CustomType,
}
let s: MyStruct = serde_json::from_str(r#"{"type":"Custom"}"#)?;
assert_eq!(s.kind, CustomType::Custom);