Could the tag optionally come from a constant instead of a string literal?
rukai opened this issue · 1 comments
rukai commented
I can see that the name
string literal is used in a function call here:
typetag/impl/src/tagged_impl.rs
Line 37 in bb67b9e
So I think typetag could additionally support the user specifying the name as a constant by specifying the constant instead of a string literal:
const CONSTANT: &str = "some name";
#[typetag::serde(name = CONSTANT)]
impl Foo for Bar { }
This would allow the user to reuse the tag name in other locations.
Does that sound reasonable to you?
dtolnay commented
Yes, I would accept a PR for this.