[][src]Macro activitystreams::kind

macro_rules! kind {
    ($x:ident, $y:ident) => { ... };
}

Generate an enum implementing serde's Serialize and Deserialize with a single variant

This is useful for describing constants

use activitystreams::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);