Derive CheckBytes trait on Archive struct
This commit is contained in:
parent
eb2b23b103
commit
2cbb27c6f8
|
@ -27,11 +27,14 @@ use std::mem;
|
|||
/// A array-based statically sized matrix data storage.
|
||||
#[repr(transparent)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct ArrayStorage<T, const R: usize, const C: usize>(pub [[T; R]; C]);
|
||||
|
||||
|
|
|
@ -13,11 +13,14 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
|||
|
||||
/// Dim of dynamically-sized algebraic entities.
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct Dynamic {
|
||||
value: usize,
|
||||
|
@ -207,7 +210,10 @@ dim_ops!(
|
|||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct Const<const R: usize>;
|
||||
|
||||
|
|
|
@ -150,11 +150,14 @@ pub type MatrixCross<T, R1, C1, R2, C2> =
|
|||
/// some concrete types for `T` and a compatible data storage type `S`).
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct Matrix<T, R, C, S> {
|
||||
/// The data storage that contains all the matrix components. Disappointed?
|
||||
|
|
|
@ -21,11 +21,14 @@ use crate::{Dim, Matrix, OMatrix, RealField, Scalar, SimdComplexField, SimdRealF
|
|||
/// in their documentation, read their dedicated pages directly.
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Hash, Copy)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
// #[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct Unit<T> {
|
||||
pub(crate) value: T,
|
||||
|
|
|
@ -40,11 +40,14 @@ use simba::scalar::{ClosedNeg, RealField};
|
|||
/// See <https://github.com/dimforge/nalgebra/issues/487>
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct DualQuaternion<T> {
|
||||
/// The real component of the quaternion
|
||||
|
|
|
@ -70,7 +70,10 @@ use crate::geometry::{AbstractRotation, Point, Translation};
|
|||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
pub struct Isometry<T, R, const D: usize> {
|
||||
/// The pure rotational part of this isometry.
|
||||
pub rotation: R,
|
||||
|
|
|
@ -19,11 +19,14 @@ use crate::geometry::{Point3, Projective3};
|
|||
|
||||
/// A 3D orthographic projection stored as a homogeneous 4x4 matrix.
|
||||
#[repr(C)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Orthographic3<T> {
|
||||
|
|
|
@ -20,11 +20,14 @@ use crate::geometry::{Point3, Projective3};
|
|||
|
||||
/// A 3D perspective projection stored as a homogeneous 4x4 matrix.
|
||||
#[repr(C)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Perspective3<T> {
|
||||
|
|
|
@ -40,7 +40,10 @@ use std::mem::MaybeUninit;
|
|||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
pub struct OPoint<T: Scalar, D: DimName>
|
||||
where
|
||||
DefaultAllocator: Allocator<T, D>,
|
||||
|
|
|
@ -23,11 +23,14 @@ use crate::geometry::{Point3, Rotation};
|
|||
/// that may be used as a rotation.
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
pub struct Quaternion<T> {
|
||||
/// This quaternion as a 4D vector of coordinates in the `[ x, y, z, w ]` storage order.
|
||||
|
|
|
@ -49,11 +49,14 @@ use crate::geometry::Point;
|
|||
/// * [Conversion to a matrix <span style="float:right;">`matrix`, `to_homogeneous`…</span>](#conversion-to-a-matrix)
|
||||
///
|
||||
#[repr(C)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Rotation<T, const D: usize> {
|
||||
|
|
|
@ -17,11 +17,14 @@ use crate::geometry::Point;
|
|||
|
||||
/// A scale which supports non-uniform scaling.
|
||||
#[repr(C)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Scale<T, const D: usize> {
|
||||
|
|
|
@ -38,7 +38,10 @@ use crate::geometry::{AbstractRotation, Isometry, Point, Translation};
|
|||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
pub struct Similarity<T, R, const D: usize> {
|
||||
/// The part of this similarity that does not include the scaling factor.
|
||||
pub isometry: Isometry<T, R, D>,
|
||||
|
|
|
@ -17,11 +17,14 @@ use crate::geometry::Point;
|
|||
|
||||
/// A translation.
|
||||
#[repr(C)]
|
||||
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize-no-std",
|
||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "rkyv-serialize",
|
||||
archive_attr(derive(bytecheck::CheckBytes))
|
||||
)]
|
||||
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Translation<T, const D: usize> {
|
||||
|
|
Loading…
Reference in New Issue