#[macro_export]
macro_rules! into {
($ty:ident { $($tt:tt)* }) => {
$crate::into!(@expand $ty {} $($tt)*)
};
(@expand $ty:ident { $($out:tt)* }) => { $ty { $($out)* } };
(@expand $ty:ident { $($out:tt)* } ,) => { $ty { $($out)* } };
(@expand $ty:ident { $($out:tt)* } & $field:ident, $($rest:tt)*) => {
$crate::into!(@expand $ty { $($out)* $field: (&$field).into(), } $($rest)*)
};
(@expand $ty:ident { $($out:tt)* } & $field:ident) => {
$crate::into!(@expand $ty { $($out)* $field: (&$field).into(), })
};
(@expand $ty:ident { $($out:tt)* } $field:ident, $($rest:tt)*) => {
$crate::into!(@expand $ty { $($out)* $field: ($field).into(), } $($rest)*)
};
(@expand $ty:ident { $($out:tt)* } $field:ident) => {
$crate::into!(@expand $ty { $($out)* $field: ($field).into(), })
};
(@expand $ty:ident { $($out:tt)* } $field:ident : $value:expr, $($rest:tt)*) => {
$crate::into!(@expand $ty { $($out)* $field: ($value).into(), } $($rest)*)
};
(@expand $ty:ident { $($out:tt)* } $field:ident : $value:expr) => {
$crate::into!(@expand $ty { $($out)* $field: ($value).into(), })
};
}
#[macro_export]
macro_rules! create {
($trx:expr, $ty:ident { $($tt:tt)* }) => {
$trx.create(&$crate::into!($ty { $($tt)* }))
};
}