diff --git a/fixed_wide_vectors/src/macros/matrix.rs b/fixed_wide_vectors/src/macros/matrix.rs index f3ebce4..23755f3 100644 --- a/fixed_wide_vectors/src/macros/matrix.rs +++ b/fixed_wide_vectors/src/macros/matrix.rs @@ -7,61 +7,16 @@ macro_rules! impl_matrix { ($struct_inner: ident, $size_inner: expr), $fields_inner:tt ) => { impl $struct_outer<$struct_inner> { - /// Consumes the matrix and returns its values as an array. - /// - /// # Example - /// - /// ``` - /// use fixed_wide_vectors::Vector2; - /// - /// let mat2 = Vector2::new( - /// Vector2::new(0, 0), - /// Vector2::new(0, 0) - /// ); - /// let array = mat2.to_array_2d(); - /// - /// assert_eq!(array, [[0, 0], [0, 0]]); - /// ``` #[inline(always)] pub fn to_array_2d(self) -> [[T; $size_inner]; $size_outer] { [ $(self.$field_outer.to_array()), + ] } - /// Consumes the matrix and returns its values as a tuple. - /// - /// # Example - /// - /// ``` - /// use fixed_wide_vectors::Vector2; - /// - /// let mat2 = Vector2::new( - /// Vector2::new(0, 0), - /// Vector2::new(0, 0) - /// ); - /// let tuple = mat2.to_tuple_2d(); - /// - /// assert_eq!(tuple, ((0, 0), (0, 0))); - /// ``` #[inline(always)] pub fn to_tuple_2d(self) -> ( $($generic_outer), + ) { ( $(self.$field_outer.to_tuple()), + ) } - /// Consumes the matrix and returns a new matrix with the given function applied on each field. - /// - /// # Example - /// - /// ``` - /// use fixed_wide_vectors::Vector2; - /// - /// let mat2 = Vector2::new( - /// Vector2::new(1, 2), - /// Vector2::new(3, 4) - /// ) - /// .map_2d(|i| i * 2); - /// - /// assert_eq!(mat2, Vector2::new(Vector2::new(2, 4), Vector2::new(6, 8))); - /// ``` #[inline] pub fn map_2d(self, f: F) -> $struct_outer<$struct_inner> where @@ -74,21 +29,6 @@ macro_rules! impl_matrix { } } - /// Consumes the matrix and returns a new matrix with the given function applied on each field. - /// - /// # Example - /// - /// ``` - /// use fixed_wide_vectors::Vector2; - /// - /// let mat2 = Vector2::new( - /// Vector2::new(1, 2), - /// Vector2::new(3, 4) - /// ) - /// .transpose(); - /// - /// assert_eq!(mat2, Vector2::new(Vector2::new(1, 3), Vector2::new(2, 4))); - /// ``` #[inline] pub fn transpose(self) -> $struct_inner<$struct_outer>{ $crate::matrix_transpose_outer!{self,$fields_inner,($struct_outer { $($field_outer), + })} @@ -96,17 +36,6 @@ macro_rules! impl_matrix { } impl $struct_outer<$struct_inner> { - /// Constructs a matrix using the given `value` as the value for all of its fields. - /// - /// # Example - /// - /// ``` - /// use fixed_wide_vectors::Vector2; - /// - /// let mat2 = Vector2::>::from_value_2d(0); - /// - /// assert_eq!(mat2, Vector2::new(Vector2::new(0, 0), Vector2::new(0, 0))); - /// ``` #[inline(always)] pub const fn from_value_2d(value: T) -> Self { Self {