cargo fmt

This commit is contained in:
zyansheep 2022-07-13 23:05:44 -04:00
parent 9a98b0cf24
commit 71379c0748
15 changed files with 69 additions and 29 deletions

View File

@ -30,10 +30,13 @@ use std::mem;
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "ArrayStorage<T::Archived, R, C>", bound(archive = "
archive(
as = "ArrayStorage<T::Archived, R, C>",
bound(archive = "
T: rkyv::Archive,
[[T; R]; C]: rkyv::Archive<Archived = [[T::Archived; R]; C]>
"))
")
)
)]
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]

View File

@ -12,7 +12,7 @@ use std::mem;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[cfg(feature = "rkyv-serialize-no-std")]
use rkyv::{Archive, Archived, with::With};
use rkyv::{with::With, Archive, Archived};
#[cfg(feature = "rkyv-serialize-no-std")]
use rkyv_wrappers::custom_phantom::CustomPhantom;
@ -158,11 +158,14 @@ pub type MatrixCross<T, R1, C1, R2, C2> =
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Matrix<T::Archived, R, C, S::Archived>", bound(archive = "
archive(
as = "Matrix<T::Archived, R, C, S::Archived>",
bound(archive = "
T: Archive,
S: Archive,
With<PhantomData<(T, R, C)>, CustomPhantom<(Archived<T>, R, C)>>: Archive<Archived = PhantomData<(Archived<T>, R, C)>>
"))
")
)
)]
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]

View File

@ -24,9 +24,12 @@ use crate::{Dim, Matrix, OMatrix, RealField, Scalar, SimdComplexField, SimdRealF
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Unit<T::Archived>", bound(archive = "
archive(
as = "Unit<T::Archived>",
bound(archive = "
T: rkyv::Archive,
"))
")
)
)]
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
// #[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]

View File

@ -44,10 +44,13 @@ use simba::scalar::{ClosedNeg, RealField};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "DualQuaternion<T::Archived>", bound(archive = "
archive(
as = "DualQuaternion<T::Archived>",
bound(archive = "
T: rkyv::Archive,
Quaternion<T>: rkyv::Archive<Archived = Quaternion<T::Archived>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
pub struct DualQuaternion<T> {

View File

@ -69,11 +69,14 @@ use crate::geometry::{AbstractRotation, Point, Translation};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Isometry<T::Archived, R::Archived, D>", bound(archive = "
archive(
as = "Isometry<T::Archived, R::Archived, D>",
bound(archive = "
T: rkyv::Archive,
R: rkyv::Archive,
Translation<T, D>: rkyv::Archive<Archived = Translation<T::Archived, D>>
"))
")
)
)]
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
pub struct Isometry<T, R, const D: usize> {

View File

@ -23,10 +23,13 @@ use crate::geometry::{Point3, Projective3};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Orthographic3<T::Archived>", bound(archive = "
archive(
as = "Orthographic3<T::Archived>",
bound(archive = "
T: rkyv::Archive,
Matrix4<T>: rkyv::Archive<Archived = Matrix4<T::Archived>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone)]

View File

@ -24,10 +24,13 @@ use crate::geometry::{Point3, Projective3};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Perspective3<T::Archived>", bound(archive = "
archive(
as = "Perspective3<T::Archived>",
bound(archive = "
T: rkyv::Archive,
Matrix4<T>: rkyv::Archive<Archived = Matrix4<T::Archived>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone)]

View File

@ -27,10 +27,13 @@ use crate::geometry::{Point3, Rotation};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Quaternion<T::Archived>", bound(archive = "
archive(
as = "Quaternion<T::Archived>",
bound(archive = "
T: rkyv::Archive,
Vector4<T>: rkyv::Archive<Archived = Vector4<T::Archived>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
pub struct Quaternion<T> {

View File

@ -53,10 +53,13 @@ use crate::geometry::Point;
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Rotation<T::Archived, D>", bound(archive = "
archive(
as = "Rotation<T::Archived, D>",
bound(archive = "
T: rkyv::Archive,
SMatrix<T, D, D>: rkyv::Archive<Archived = SMatrix<T::Archived, D, D>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone)]

View File

@ -21,10 +21,13 @@ use crate::geometry::Point;
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Scale<T::Archived, D>", bound(archive = "
archive(
as = "Scale<T::Archived, D>",
bound(archive = "
T: rkyv::Archive,
SVector<T, D>: rkyv::Archive<Archived = SVector<T::Archived, D>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone)]

View File

@ -37,11 +37,14 @@ use crate::geometry::{AbstractRotation, Isometry, Point, Translation};
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Similarity<T::Archived, R::Archived, D>", bound(archive = "
archive(
as = "Similarity<T::Archived, R::Archived, D>",
bound(archive = "
T: rkyv::Archive,
R: rkyv::Archive,
Isometry<T, R, D>: rkyv::Archive<Archived = Isometry<T::Archived, R::Archived, D>>
"))
")
)
)]
#[cfg_attr(feature = "rkyv-serialize", derive(bytecheck::CheckBytes))]
pub struct Similarity<T, R, const D: usize> {

View File

@ -21,10 +21,13 @@ use crate::geometry::Point;
#[cfg_attr(
feature = "rkyv-serialize-no-std",
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize),
archive(as = "Translation<T::Archived, D>", bound(archive = "
archive(
as = "Translation<T::Archived, D>",
bound(archive = "
T: rkyv::Archive,
SVector<T, D>: rkyv::Archive<Archived = SVector<T::Archived, D>>
"))
")
)
)]
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
#[derive(Copy, Clone)]

View File

@ -83,7 +83,11 @@ an optimized set of tools for computer graphics and physics. Those features incl
missing_copy_implementations
)]
#![cfg_attr(feature = "rkyv-serialize-no-std", allow(unused_results))] // TODO: deny this once bytecheck stops generating warnings.
#![cfg_attr(not(feature = "rkyv-serialize-no-std"), deny(unused_results), deny(unused_qualifications))] // TODO: deny this globally
#![cfg_attr(
not(feature = "rkyv-serialize-no-std"),
deny(unused_results),
deny(unused_qualifications)
)] // TODO: deny this globally
#![doc(
html_favicon_url = "https://nalgebra.org/img/favicon.ico",
html_root_url = "https://docs.rs/nalgebra/0.25.0"

View File

@ -7,8 +7,8 @@ mod matrix;
mod matrix_slice;
#[cfg(feature = "mint")]
mod mint;
mod serde;
mod rkyv;
mod serde;
#[cfg(feature = "compare")]
mod matrixcompare;

View File

@ -6,7 +6,7 @@ use na::{
SimilarityMatrix3, Translation2, Translation3, Unit, Vector2,
};
use rand;
use rkyv::{Archive, Serialize, Deserialize, Infallible};
use rkyv::{Archive, Deserialize, Infallible, Serialize};
macro_rules! test_rkyv_archived_impls(
($($test: ident, $ty: ident);* $(;)*) => {$(