#[macro_export]
macro_rules! qecs_newtype {
($(#[$mmm:meta])* pub type $ty:ident: $base:ty) => {
qecs_newtype!($(#[$mmm])* pub type $ty: $base;);
};
($(#[$mmm:meta])* type $ty:ident: $base:ty) => {
qecs_newtype!($(#[$mmm])* type $ty: $base;);
};
($($(#[$mmm:meta])* pub type $ty:ident: $base:ty;)+) => {$(
$(#[$mmm])*
pub struct $ty<__B = $base> {
__base: __B
}
qecs_newtype!(@impl_traits; $ty; $base);
)+};
($($(#[$mmm:meta])* type $ty:ident: $base:ty;)+) => {$(
$(#[$mmm])*
struct $ty {
__base: $base
}
qecs_newtype!(@impl_traits; $ty; $base);
)+};
(@impl_traits; $ty:ident; $base:ty) => {
impl ::std::convert::From<$base> for $ty {
fn from(base: $base) -> Self { $ty{ __base: base } }
}
impl ::std::convert::Into<$base> for $ty {
fn into(self) -> $base { self.__base }
}
impl ::std::ops::Deref for $ty {
type Target = $base;
fn deref(&self) -> &Self::Target { &self.__base }
}
impl ::std::ops::DerefMut for $ty {
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.__base }
}
};
}