#[macro_export]
macro_rules! enclose_var {
[ $(,)? ] => {};
[
ref $a: expr => mut $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let ref mut $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
ref $a: expr => $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let ref $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
move $a: expr => mut $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let mut $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
move $a: expr => $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
*$a: expr => mut $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let mut $b $(: $ty)? = *$a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
*$a: expr => $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let $b $(: $ty)? = *$a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
@$a: expr => mut $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let mut $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
@$a: expr => $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let $b $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
ref mut $a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let ref mut $a $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
ref $a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let ref $a $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
move mut $a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let mut $a $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
move $a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let $a $(: $ty)? = $a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
$a: expr => mut $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let mut $b $(: $ty)? = $a.clone();
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
$a: expr => $b: ident $(: $ty:ty)?
$(, $($tt:tt)* )?
] => {
let $b $(: $ty)? = $a.clone();
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
mut *$a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let mut $a $(: $ty)? = *$a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
*$a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let $a $(: $ty)? = *$a;
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
mut $a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let mut $a $(: $ty)? = $a.clone();
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
$a: ident $(: $ty:ty)?
$(, $($tt:tt)*)?
] => {
let $a $(: $ty)? = $a.clone();
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
[
{$($b:tt)*}
$(, $($tt:tt)*)?
] => {
let _hidden = {
$($b)*
};
$(
$crate::enclose_var! {
$($tt)*
}
)?
};
}