[−][src]Derive Macro activitystreams_derive::UnitString
#[derive(UnitString)]
{
// Attributes available to this derive:
#[activitystreams]
}Derive implementations Serialize and Deserialize for a constant string Struct type
ⓘThis example is not tested
/// Derive Serialize and Deserialize such that MyStruct becomes the "MyType" string #[derive(Clone, Debug, UnitString)] #[activitystreams(MyType)] pub struct MyStruct; // usage let _: HashMap<String, MyStruct> = serde_json::from_str(r#"{"type":"MyType"}"#)?;