macro-generate froms

This commit is contained in:
Aleksey Kladov 2019-01-24 19:12:11 +03:00
parent aea1f95a66
commit a7c0336a75
4 changed files with 17 additions and 78 deletions

View file

@ -5,6 +5,18 @@
//! to a particular crate instance. That is, it has cfg flags and features
//! applied. So, the relation between syntax and HIR is many-to-one.
macro_rules! impl_froms {
($e:ident: $($v:ident), *) => {
$(
impl From<$v> for $e {
fn from(it: $v) -> $e {
$e::$v(it)
}
}
)*
}
}
pub mod db;
#[cfg(test)]
mod mock;