Implement IntoMint trait for Vectors, Points, Matrices, and Quaternions

- Updated mint to 0.5.8, so that the IntoMint trait is available
- Implemented IntoMint for Vectors, Points, Matrices, and Quaternions
This commit is contained in:
Andrei Jardan 2021-11-25 13:45:53 +02:00
parent af127633cc
commit d4d19b9122
4 changed files with 14 additions and 2 deletions

View file

@ -22,7 +22,7 @@ swizzle = []
[dependencies]
approx = "0.5"
mint = { version = "0.5", optional = true }
mint = { version = "0.5.8", optional = true }
num-traits = "0.2"
# small_rng used only for benchmarks
rand = { version = "0.8", features = ["small_rng"], optional = true }

View file

@ -373,6 +373,10 @@ macro_rules! impl_mint_conversions {
$ArrayN { $( $field: v.$field, )+ }
}
}
impl<S: Clone> mint::IntoMint for $ArrayN<S> {
type MintType = mint::$Mint<S>;
}
}
}

View file

@ -1559,6 +1559,9 @@ macro_rules! mint_conversions {
}
}
impl<S: Clone> mint::IntoMint for $MatrixN<S> {
type MintType = mint::$MintN<S>;
}
}
}

View file

@ -685,6 +685,11 @@ impl<S: Clone> From<Quaternion<S>> for mint::Quaternion<S> {
}
}
#[cfg(feature = "mint")]
impl <S: Clone> mint::IntoMint for Quaternion<S> {
type MintType = mint::Quaternion<S>;
}
#[cfg(test)]
mod tests {
use quaternion::*;