Fix bounds for bytemuck impls

This commit is contained in:
CAD97 2021-07-09 15:23:08 -05:00
parent 396d3d6615
commit 22ba88353a
6 changed files with 45 additions and 12 deletions

View File

@ -242,10 +242,20 @@ where
} }
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Zeroable for DualQuaternion<T> where Quaternion<T>: bytemuck::Zeroable {} unsafe impl<T> bytemuck::Zeroable for DualQuaternion<T>
where
T: Scalar + bytemuck::Zeroable,
Quaternion<T>: bytemuck::Zeroable,
{
}
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Pod for DualQuaternion<T> where Quaternion<T>: bytemuck::Pod {} unsafe impl<T> bytemuck::Pod for DualQuaternion<T>
where
T: Scalar + bytemuck::Pod,
Quaternion<T>: bytemuck::Pod,
{
}
#[cfg(feature = "serde-serialize-no-std")] #[cfg(feature = "serde-serialize-no-std")]
impl<T: SimdRealField> Serialize for DualQuaternion<T> impl<T: SimdRealField> Serialize for DualQuaternion<T>

View File

@ -46,10 +46,20 @@ impl<T: RealField> PartialEq for Orthographic3<T> {
} }
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Zeroable for Orthographic3<T> where Matrix4<T>: bytemuck::Zeroable {} unsafe impl<T> bytemuck::Zeroable for Orthographic3<T>
where
T: RealField + bytemuck::Zeroable,
Matrix4<T>: bytemuck::Zeroable,
{
}
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Pod for Orthographic3<T> where Matrix4<T>: bytemuck::Pod {} unsafe impl<T> bytemuck::Pod for Orthographic3<T>
where
T: RealField + bytemuck::Pod,
Matrix4<T>: bytemuck::Pod,
{
}
#[cfg(feature = "serde-serialize-no-std")] #[cfg(feature = "serde-serialize-no-std")]
impl<T: RealField + Serialize> Serialize for Orthographic3<T> { impl<T: RealField + Serialize> Serialize for Orthographic3<T> {

View File

@ -47,10 +47,20 @@ impl<T: RealField> PartialEq for Perspective3<T> {
} }
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Zeroable for Perspective3<T> where Matrix4<T>: bytemuck::Zeroable {} unsafe impl<T> bytemuck::Zeroable for Perspective3<T>
where
T: RealField + bytemuck::Zeroable,
Matrix4<T>: bytemuck::Zeroable,
{
}
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T> bytemuck::Pod for Perspective3<T> where Matrix4<T>: bytemuck::Pod {} unsafe impl<T> bytemuck::Pod for Perspective3<T>
where
T: RealField + bytemuck::Pod,
Matrix4<T>: bytemuck::Pod,
{
}
#[cfg(feature = "serde-serialize-no-std")] #[cfg(feature = "serde-serialize-no-std")]
impl<T: RealField + Serialize> Serialize for Perspective3<T> { impl<T: RealField + Serialize> Serialize for Perspective3<T> {

View File

@ -86,7 +86,7 @@ where
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T, const D: usize> bytemuck::Zeroable for Rotation<T, D> unsafe impl<T, const D: usize> bytemuck::Zeroable for Rotation<T, D>
where where
T: Scalar, T: Scalar + bytemuck::Zeroable,
SMatrix<T, D, D>: bytemuck::Zeroable, SMatrix<T, D, D>: bytemuck::Zeroable,
{ {
} }
@ -94,7 +94,7 @@ where
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T, const D: usize> bytemuck::Pod for Rotation<T, D> unsafe impl<T, const D: usize> bytemuck::Pod for Rotation<T, D>
where where
T: Scalar, T: Scalar + bytemuck::Pod,
SMatrix<T, D, D>: bytemuck::Pod, SMatrix<T, D, D>: bytemuck::Pod,
{ {
} }

View File

@ -195,8 +195,9 @@ where
} }
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T: RealField, C: TCategory, const D: usize> bytemuck::Zeroable for Transform<T, C, D> unsafe impl<T, C: TCategory, const D: usize> bytemuck::Zeroable for Transform<T, C, D>
where where
T: RealField + bytemuck::Zeroable,
Const<D>: DimNameAdd<U1>, Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>, DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: bytemuck::Zeroable, OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: bytemuck::Zeroable,
@ -204,11 +205,13 @@ where
} }
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T: RealField, C: TCategory, const D: usize> bytemuck::Pod for Transform<T, C, D> unsafe impl<T, C: TCategory, const D: usize> bytemuck::Pod for Transform<T, C, D>
where where
T: RealField + bytemuck::Pod,
Const<D>: DimNameAdd<U1>, Const<D>: DimNameAdd<U1>,
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>, DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: bytemuck::Pod, OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: bytemuck::Pod,
Owned<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>: Copy,
{ {
} }

View File

@ -53,7 +53,7 @@ where
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T, const D: usize> bytemuck::Zeroable for Translation<T, D> unsafe impl<T, const D: usize> bytemuck::Zeroable for Translation<T, D>
where where
T: Scalar, T: Scalar + bytemuck::Zeroable,
SVector<T, D>: bytemuck::Zeroable, SVector<T, D>: bytemuck::Zeroable,
{ {
} }
@ -61,7 +61,7 @@ where
#[cfg(feature = "bytemuck")] #[cfg(feature = "bytemuck")]
unsafe impl<T, const D: usize> bytemuck::Pod for Translation<T, D> unsafe impl<T, const D: usize> bytemuck::Pod for Translation<T, D>
where where
T: Scalar, T: Scalar + bytemuck::Pod,
SVector<T, D>: bytemuck::Pod, SVector<T, D>: bytemuck::Pod,
{ {
} }