Is it possible to use share constant with custom derive?
#[derive(Serialize, Deserialize)]
#[serde(tag = "type", rename = "xyz", rename_all = "camelCase")]
struct S {
//some fields
}
I mean give name to "xyz" as share it withing my code base?
I tried:
macro_rules! foo {
() => {
"BOO"
};
}
#[derive(Serialize, Deserialize)]
#[serde(tag = "type", rename = foo!(), rename_all = "camelCase")]
struct S {
i: i32,
}
but compilation failed,
any way to share constant with custom derive? Or may be it is possible to get this constant from serde? Like <S as SerdeGetTagTrait>::tag() ?