can't get rid of the double pattern match not knowing which repeated variable to loop

This commit is contained in:
Quaternions 2024-08-28 11:30:22 -07:00
parent 23a6ffb243
commit c9b999b8a6

View File

@ -250,17 +250,34 @@ macro_rules! impl_vector {
};
}
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix_inner {
( $struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr,
$field_inner: ident) => {
$struct_outer {
$(
$field_outer: self.$field_outer.$field_inner
),+
}
}
}
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix {
( $struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr,
( $struct_outer: ident { $($field_outer: ident),+ }, $size_outer: expr,
$struct_inner: ident { $($field_inner: ident), + }, $size_inner: expr ) => {
impl<T> Transpose for $struct_outer<$struct_inner<T>> {
fn transpose(self) -> $struct_inner<$struct_outer<T>> {
$struct_inner{
$( $field_inner: $struct_outer {
$( $field_outer: self.$field_outer.$field_inner), +
} ), +
$struct_inner {
$(
$field_inner: impl_matrix_inner!(
$struct_outer { $($field_outer),+ }, $size_outer,
$field_inner
)
),+
}
}
}