generalize impl_froms to nested enums
This commit is contained in:
@@ -8,13 +8,20 @@
|
||||
//! applied. So, the relation between syntax and HIR is many-to-one.
|
||||
|
||||
macro_rules! impl_froms {
|
||||
($e:ident: $($v:ident),*) => {
|
||||
($e:ident: $($v:ident $(($($sv:ident),*))?),*) => {
|
||||
$(
|
||||
impl From<$v> for $e {
|
||||
fn from(it: $v) -> $e {
|
||||
$e::$v(it)
|
||||
}
|
||||
}
|
||||
$($(
|
||||
impl From<$sv> for $e {
|
||||
fn from(it: $sv) -> $e {
|
||||
$e::$v($v::$sv(it))
|
||||
}
|
||||
}
|
||||
)*)?
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user