Open rukai opened 8 months ago
I can see that the name string literal is used in a function call here: https://github.com/dtolnay/typetag/blob/bb67b9e5feb6007e37b9760a30afacfb5900eeb0/impl/src/tagged_impl.rs#L37 So I think typetag could additionally support the user specifying the name as a constant by specifying the constant instead of a string literal:
name
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?
Yes, I would accept a PR for this.
I can see that the
name
string literal is used in a function call here: https://github.com/dtolnay/typetag/blob/bb67b9e5feb6007e37b9760a30afacfb5900eeb0/impl/src/tagged_impl.rs#L37 So I think typetag could additionally support the user specifying the name as a constant by specifying the constant instead of a string literal:This would allow the user to reuse the tag name in other locations.
Does that sound reasonable to you?