#[doc(hidden)]
#[macro_export]
macro_rules! __impl_deref {
($ident:ident) => {
impl<T> std::ops::Deref for $ident<T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<T> std::ops::DerefMut for $ident<T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
};
($ident:ident: $ty:ty) => {
impl std::ops::Deref for $ident {
type Target = $ty;
#[inline]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl std::ops::DerefMut for $ident {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __impl_copy {
($ident:ident) => {
impl<T: Copy> Copy for $ident<T> {}
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! panic_on_err {
($expr:expr) => {
match $expr {
Ok(x) => x,
Err(err) => panic!("{err}"),
}
};
}