delete spam doc tests
This commit is contained in:
parent
e413409f9f
commit
9aba811cd0
@ -7,61 +7,16 @@ macro_rules! impl_matrix {
|
|||||||
($struct_inner: ident, $size_inner: expr), $fields_inner:tt
|
($struct_inner: ident, $size_inner: expr), $fields_inner:tt
|
||||||
) => {
|
) => {
|
||||||
impl<T> $struct_outer<$struct_inner<T>> {
|
impl<T> $struct_outer<$struct_inner<T>> {
|
||||||
/// 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)]
|
#[inline(always)]
|
||||||
pub fn to_array_2d(self) -> [[T; $size_inner]; $size_outer] {
|
pub fn to_array_2d(self) -> [[T; $size_inner]; $size_outer] {
|
||||||
[ $(self.$field_outer.to_array()), + ]
|
[ $(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)]
|
#[inline(always)]
|
||||||
pub fn to_tuple_2d(self) -> ( $($generic_outer), + ) {
|
pub fn to_tuple_2d(self) -> ( $($generic_outer), + ) {
|
||||||
( $(self.$field_outer.to_tuple()), + )
|
( $(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]
|
#[inline]
|
||||||
pub fn map_2d<F, U>(self, f: F) -> $struct_outer<$struct_inner<U>>
|
pub fn map_2d<F, U>(self, f: F) -> $struct_outer<$struct_inner<U>>
|
||||||
where
|
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]
|
#[inline]
|
||||||
pub fn transpose(self) -> $struct_inner<$struct_outer<T>>{
|
pub fn transpose(self) -> $struct_inner<$struct_outer<T>>{
|
||||||
$crate::matrix_transpose_outer!{self,$fields_inner,($struct_outer { $($field_outer), + })}
|
$crate::matrix_transpose_outer!{self,$fields_inner,($struct_outer { $($field_outer), + })}
|
||||||
@ -96,17 +36,6 @@ macro_rules! impl_matrix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Copy> $struct_outer<$struct_inner<T>> {
|
impl<T: Copy> $struct_outer<$struct_inner<T>> {
|
||||||
/// Constructs a matrix using the given `value` as the value for all of its fields.
|
|
||||||
///
|
|
||||||
/// # Example
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use fixed_wide_vectors::Vector2;
|
|
||||||
///
|
|
||||||
/// let mat2 = Vector2::<Vector2<_>>::from_value_2d(0);
|
|
||||||
///
|
|
||||||
/// assert_eq!(mat2, Vector2::new(Vector2::new(0, 0), Vector2::new(0, 0)));
|
|
||||||
/// ```
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub const fn from_value_2d(value: T) -> Self {
|
pub const fn from_value_2d(value: T) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user