Merge pull request #539 from CyborgSquirrel/master

Implement IntoMint trait for Vectors, Points, Matrices, and Quaternions
This commit is contained in:
aloucks 2021-11-26 09:11:33 -05:00 committed by GitHub
commit 78c082e944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

@ -1558,7 +1558,10 @@ macro_rules! mint_conversions {
$MatrixN { $($field: m.$field.into()),+ }
}
}
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::*;