Added bytemuck for Unit and Quaternion.

This commit is contained in:
iMplode nZ 2021-02-12 15:30:12 -08:00
parent c667b1f9c8
commit 1c0891bbbb
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,12 @@ pub struct Unit<T> {
pub(crate) value: T,
}
#[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Zeroable for Unit<T> where T: bytemuck::Zeroable {}
#[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Pod for Unit<T> where T: bytemuck::Pod {}
#[cfg(feature = "serde-serialize")]
impl<T: Serialize> Serialize for Unit<T> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>

View File

@ -40,6 +40,12 @@ impl<N: Scalar + Zero> Default for Quaternion<N> {
}
}
#[cfg(feature = "bytemuck")]
unsafe impl<N: Scalar> bytemuck::Zeroable for Quaternion<N> where Vector4<N>: bytemuck::Zeroable {}
#[cfg(feature = "bytemuck")]
unsafe impl<N: Scalar> bytemuck::Pod for Quaternion<N> where Vector4<N>: bytemuck::Pod, N: Copy {}
#[cfg(feature = "abomonation-serialize")]
impl<N: Scalar> Abomonation for Quaternion<N>
where