Skip to content

Commit

Permalink
Always enable rkyv validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Apr 7, 2023
1 parent 95cac1f commit 0087c0e
Show file tree
Hide file tree
Showing 41 changed files with 115 additions and 119 deletions.
3 changes: 1 addition & 2 deletions crates/parry2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ std = [ "nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "
dim2 = [ ]
f64 = [ ]
serde-serialize = [ "serde", "nalgebra/serde-serialize", "arrayvec/serde" ]
rkyv-serialize = [ "rkyv", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
rkyv-serialize = [ "rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
bytemuck-serialize = [ "bytemuck", "nalgebra/convert-bytemuck" ]
simd-stable = [ "simba/wide", "simd-is-enabled" ]
simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
Expand Down
3 changes: 1 addition & 2 deletions crates/parry2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ std = [ "nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "
dim2 = [ ]
f32 = [ ]
serde-serialize = [ "serde", "nalgebra/serde-serialize", "arrayvec/serde" ]
rkyv-serialize = [ "rkyv", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
rkyv-serialize = [ "rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
bytemuck-serialize = [ "bytemuck", "nalgebra/convert-bytemuck" ]
simd-stable = [ "simba/wide", "simd-is-enabled" ]
simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
Expand Down
3 changes: 1 addition & 2 deletions crates/parry3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ std = [ "nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "
dim3 = [ ]
f64 = [ ]
serde-serialize = [ "serde", "nalgebra/serde-serialize" ]
rkyv-serialize = [ "rkyv", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
rkyv-serialize = [ "rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
bytemuck-serialize = [ "bytemuck", "nalgebra/convert-bytemuck" ]
simd-stable = [ "simba/wide", "simd-is-enabled" ]
simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
Expand Down
3 changes: 1 addition & 2 deletions crates/parry3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ std = [ "nalgebra/std", "slab", "rustc-hash", "simba/std", "arrayvec/std", "
dim3 = [ ]
f32 = [ ]
serde-serialize = [ "serde", "nalgebra/serde-serialize" ]
rkyv-serialize = [ "rkyv", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
rkyv-serialize = [ "rkyv/validation", "nalgebra/rkyv-serialize", "simba/rkyv-serialize" ]
bytemuck-serialize = [ "bytemuck", "nalgebra/convert-bytemuck" ]

simd-stable = [ "simba/wide", "simd-is-enabled" ]
Expand Down
4 changes: 2 additions & 2 deletions src/bounding_volume/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use na::ComplexField; // for .abs()
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Debug, PartialEq, Copy, Clone)]
#[repr(C)]
Expand Down
4 changes: 2 additions & 2 deletions src/bounding_volume/bounding_sphere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use num::Zero;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Debug, PartialEq, Copy, Clone)]
#[repr(C)]
pub struct BoundingSphere {
Expand Down
4 changes: 2 additions & 2 deletions src/bounding_volume/simd_aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use simba::simd::{SimdPartialOrd, SimdValue};
#[derive(Debug, Copy, Clone)]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
pub struct SimdAabb {
/// The min coordinates of the Aabbs.
Expand Down
4 changes: 2 additions & 2 deletions src/mass_properties/mass_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const EPSILON: Real = f32::EPSILON as Real;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
/// The local mass properties of a rigid-body.
pub struct MassProperties {
/// The center of mass of a rigid-body expressed in its local-space.
Expand Down
16 changes: 8 additions & 8 deletions src/partitioning/qbvh/qbvh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ pub type SimdNodeIndex = u32;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
/// The index of one specific node of a Qbvh.
pub struct NodeIndex {
Expand Down Expand Up @@ -116,9 +116,9 @@ bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
pub struct QbvhNode {
/// The Aabbs of the qbvh nodes represented by this node.
Expand Down Expand Up @@ -190,9 +190,9 @@ impl QbvhNode {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
/// Combination of a leaf data and its associated node’s index.
pub struct QbvhProxy<LeafData> {
Expand Down Expand Up @@ -231,9 +231,9 @@ impl<LeafData> QbvhProxy<LeafData> {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[repr(C)] // Needed for Cuda.
#[derive(Debug)]
pub struct GenericQbvh<LeafData, Storage: QbvhStorage<LeafData>> {
Expand Down
4 changes: 2 additions & 2 deletions src/query/closest_points/closest_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use std::mem;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
pub enum ClosestPoints {
/// The two objects are intersecting.
Intersecting,
Expand Down
4 changes: 2 additions & 2 deletions src/query/contact/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use std::mem;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
pub struct Contact {
/// Position of the contact on the first object.
pub point1: Point<Real>,
Expand Down
4 changes: 2 additions & 2 deletions src/query/contact_manifolds/contact_manifold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::shape::PackedFeatureId;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
/// A single contact between two shape.
pub struct TrackedContact<Data> {
/// The contact point in the local-space of the first shape.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use crate::utils::IsometryOpt;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone)]
struct SubDetector {
manifold_id: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use crate::utils::IsometryOpt;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone)]
struct SubDetector {
manifold_id: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use crate::query::contact_manifolds::InternalEdgesFixer;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone)]
struct SubDetector {
manifold_id: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use crate::query::contact_manifolds::InternalEdgesFixer;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone)]
struct SubDetector {
manifold_id: usize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::shape::{Shape, TriMesh};
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone)]
pub struct TriMeshShapeContactManifoldsWorkspace {
interferences: Vec<u32>,
Expand Down
4 changes: 2 additions & 2 deletions src/query/contact_manifolds/internal_edges_fixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use crate::math::Real;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Default, Clone)]
#[allow(dead_code)] // We will need these for 2D too in the future.
pub struct InternalEdgesFixer {
Expand Down
4 changes: 2 additions & 2 deletions src/query/point/point_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use na;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
pub struct PointProjection {
/// Whether or not the point to project was inside of the shape.
pub is_inside: bool,
Expand Down
8 changes: 4 additions & 4 deletions src/query/ray/ray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use crate::shape::FeatureId;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[repr(C)]
pub struct Ray {
Expand Down Expand Up @@ -63,9 +63,9 @@ impl Ray {
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
pub struct RayIntersection {
/// The time of impact of the ray with the object. The exact contact point can be computed
/// with: `ray.point_at(toi)` or equivalently `origin + dir * toi` where `origin` is the origin of the ray;
Expand Down
4 changes: 2 additions & 2 deletions src/shape/ball.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use crate::shape::SupportMap;
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(PartialEq, Debug, Copy, Clone)]
#[repr(C)]
Expand Down
4 changes: 2 additions & 2 deletions src/shape/capsule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use either::Either;
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[repr(C)]
/// A capsule shape defined as a round segment.
Expand Down
4 changes: 2 additions & 2 deletions src/shape/cone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use na::RealField; // for .copysign()
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(PartialEq, Debug, Copy, Clone)]
#[repr(C)]
Expand Down
4 changes: 2 additions & 2 deletions src/shape/convex_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use na::{self, ComplexField, RealField, Unit};
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(Clone, Debug)]
pub struct ConvexPolygon {
points: Vec<Point<Real>>,
Expand Down
20 changes: 10 additions & 10 deletions src/shape/convex_polyhedron.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use na::ComplexField; // for .abs()
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(PartialEq, Debug, Copy, Clone)]
pub struct Vertex {
pub first_adj_face_or_edge: u32,
Expand All @@ -26,9 +26,9 @@ pub struct Vertex {
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(PartialEq, Debug, Copy, Clone)]
pub struct Edge {
pub vertices: Point2<u32>,
Expand All @@ -51,9 +51,9 @@ impl Edge {
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(PartialEq, Debug, Copy, Clone)]
pub struct Face {
pub first_vertex_or_edge: u32,
Expand All @@ -64,9 +64,9 @@ pub struct Face {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(PartialEq, Debug, Copy, Clone)]
struct Triangle {
vertices: [u32; 3],
Expand All @@ -91,9 +91,9 @@ impl Triangle {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize)
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[derive(PartialEq, Debug, Clone)]
/// A convex polyhedron without degenerate faces.
pub struct ConvexPolyhedron {
Expand Down
4 changes: 2 additions & 2 deletions src/shape/cuboid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use na::RealField; // for .copysign()
#[cfg_attr(
feature = "rkyv",
derive(rkyv::Archive, rkyv::Deserialize, rkyv::Serialize),
archive(as = "Self")
archive(as = "Self"),
archive(check_bytes)
)]
#[cfg_attr(feature = "rkyv-safe-deser", archive(check_bytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(PartialEq, Debug, Copy, Clone)]
#[repr(C)]
Expand Down
Loading

0 comments on commit 0087c0e

Please sign in to comment.