use super::{FailedAccess, InfallibleAccess};
pub trait NormalizeFields {
type Output;
fn normalize_fields(self) -> Self::Output;
}
pub type NormalizeFieldsOut<This> = <This as NormalizeFields>::Output;
impl<T> NormalizeFields for Result<T, InfallibleAccess> {
type Output = T;
#[inline(always)]
fn normalize_fields(self) -> Self::Output {
match self {
Ok(x) => x,
Err(e) => match e {},
}
}
}
impl<T> NormalizeFields for Result<T, FailedAccess> {
type Output = Option<T>;
#[inline(always)]
fn normalize_fields(self) -> Self::Output {
self.ok()
}
}
macro_rules! normalize_tuple {
(
$(( $(($elem:ident,$index:tt),)* ))*
) => {
$(
impl<$($elem,)*> NormalizeFields for ($($elem,)*)
where
$($elem:NormalizeFields,)*
{
type Output=(
$(NormalizeFieldsOut<$elem>,)*
);
#[inline(always)]
fn normalize_fields(self)->Self::Output{
(
$(self.$index.normalize_fields(),)*
)
}
}
)*
};
}
normalize_tuple! {
( )
( (C0,0), )
( (C0,0), (C1,1), )
( (C0,0), (C1,1), (C2,2), )
( (C0,0), (C1,1), (C2,2), (C3,3), )
( (C0,0), (C1,1), (C2,2), (C3,3), (C4,4), )
( (C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), )
( (C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), )
( (C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7), )
(
(C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7),
(C8,8),
)
(
(C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7),
(C8,8), (C9,9),
)
(
(C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7),
(C8,8), (C9,9), (C10,10),
)
(
(C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7),
(C8,8), (C9,9), (C10,10), (C11,11),
)
(
(C0,0), (C1,1), (C2,2), (C3,3), (C4,4), (C5,5), (C6,6), (C7,7),
(C8,8), (C9,9), (C10,10), (C11,11), (C12,12),
)
}