macro_rules! reify {
($old:ident, |$new:ident : $t:ty| $code:expr, || $fallback:expr) => { ... };
($old:expr, |$new:ident : $t:ty| $code:expr, || $fallback:expr) => { ... };
($old:ident, |$new:ident : $t:ty| $code:expr) => { ... };
($old:expr, |$new:ident : $t:ty| $code:expr) => { ... };
($old:ident => Option<$t:ty>) => { ... };
($old:expr => Option<$t:ty>) => { ... };
($old:ident => $t:ty) => { ... };
($old:expr => $t:ty) => { ... };
}
Expand description
Macro to cast an identifier or expression to another type with type checks.
Runs code if variable or expression is of type type, otherwise run fallback.
Syntax
reify!(
variable or expression,|
temp-variable:
type|
code,
||
fallback)
reify!(
variable or expression,|
temp-variable:
type|
code)
reify!(
variable or expression=>
Option<
type>
)
reify!(
variable or expression=>
type)