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