strum
strum copied to clipboard
Produce fully-qualified variant with AsRefStr?
I'm looking for a way to ensure that the Register
variant in the Activities
enum within each module does not collide when being converted to a &str
using .as_ref()
. Is there anyway supported/blessed way to do this, besides modifying the variant names to explicitly include the module name?
mod user {
#[derive(AsRefStr)]
enum Activities {
Register,
}
}
mod task {
#[derive(AsRefStr)]
enum Activities {
Register,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn do_not_collide() {
assert_ne!(user::Activities::Register.as_ref(), task::Activities::Register.as_ref())
}
}
I believe #92 would help solve this, but we don't have support for this type of feature currently