upgrade rkyv to 0.7
This commit is contained in:
parent
ee89f1af00
commit
8c36ab4ceb
@ -79,7 +79,7 @@ alga = { version = "0.9", default-features = false, optional = true }
|
||||
rand_distr = { version = "0.4", default-features = false, optional = true }
|
||||
matrixmultiply = { version = "0.3", optional = true }
|
||||
serde = { version = "1.0", default-features = false, features = [ "derive" ], optional = true }
|
||||
rkyv = { version = "~0.6.4", default-features = false, features = ["const_generics"], optional = true }
|
||||
rkyv = { version = "~0.7.1", optional = true }
|
||||
mint = { version = "0.5", optional = true }
|
||||
quickcheck = { version = "1", optional = true }
|
||||
pest = { version = "2", optional = true }
|
||||
|
@ -277,23 +277,15 @@ unsafe impl<T: Scalar + Copy + bytemuck::Pod, const R: usize, const C: usize> by
|
||||
#[cfg(feature = "rkyv-serialize-no-std")]
|
||||
mod rkyv_impl {
|
||||
use super::ArrayStorage;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive, const R: usize, const C: usize> Archive for ArrayStorage<T, R, C> {
|
||||
type Archived = ArrayStorage<T::Archived, R, C>;
|
||||
type Resolver = <[[T; R]; C] as Archive>::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.0.resolve(
|
||||
pos + offset_of!(Self::Archived, 0),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => 0),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.0);
|
||||
self.0.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,13 +242,7 @@ mod rkyv_impl {
|
||||
type Archived = Self;
|
||||
type Resolver = ();
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
_: usize,
|
||||
_: Self::Resolver,
|
||||
_: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
}
|
||||
unsafe fn resolve(&self, _: usize, _: Self::Resolver, _: *mut Self::Archived) {}
|
||||
}
|
||||
|
||||
impl<S: Fallible + ?Sized, const R: usize> Serialize<S> for Const<R> {
|
||||
|
@ -292,23 +292,15 @@ where
|
||||
mod rkyv_impl {
|
||||
use super::Matrix;
|
||||
use core::marker::PhantomData;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive, R: Archive, C: Archive, S: Archive> Archive for Matrix<T, R, C, S> {
|
||||
type Archived = Matrix<T::Archived, R::Archived, C::Archived, S::Archived>;
|
||||
type Resolver = S::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.data.resolve(
|
||||
pos + offset_of!(Self::Archived, data),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => data),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.data);
|
||||
self.data.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,23 +61,15 @@ impl<'de, T: Deserialize<'de>> Deserialize<'de> for Unit<T> {
|
||||
#[cfg(feature = "rkyv-serialize-no-std")]
|
||||
mod rkyv_impl {
|
||||
use super::Unit;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive> Archive for Unit<T> {
|
||||
type Archived = Unit<T::Archived>;
|
||||
type Resolver = T::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut ::core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.value.resolve(
|
||||
pos + offset_of!(Self::Archived, value),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => value),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.value);
|
||||
self.value.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ pub struct Isometry<T, R, const D: usize> {
|
||||
mod rkyv_impl {
|
||||
use super::Isometry;
|
||||
use crate::{base::Scalar, geometry::Translation};
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Scalar + Archive, R: Archive, const D: usize> Archive for Isometry<T, R, D>
|
||||
where
|
||||
@ -86,22 +86,11 @@ mod rkyv_impl {
|
||||
type Archived = Isometry<T::Archived, R::Archived, D>;
|
||||
type Resolver = (R::Resolver, <Translation<T, D> as Archive>::Resolver);
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.rotation.resolve(
|
||||
pos + offset_of!(Self::Archived, rotation),
|
||||
resolver.0,
|
||||
project_struct!(out: Self::Archived => rotation),
|
||||
);
|
||||
self.translation.resolve(
|
||||
pos + offset_of!(Self::Archived, translation),
|
||||
resolver.1,
|
||||
project_struct!(out: Self::Archived => translation),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.rotation);
|
||||
self.rotation.resolve(pos + fp, resolver.0, fo);
|
||||
let (fp, fo) = out_field!(out.translation);
|
||||
self.translation.resolve(pos + fp, resolver.1, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,23 +101,15 @@ where
|
||||
mod rkyv_impl {
|
||||
use super::Quaternion;
|
||||
use crate::base::Vector4;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive> Archive for Quaternion<T> {
|
||||
type Archived = Quaternion<T::Archived>;
|
||||
type Resolver = <Vector4<T> as Archive>::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.coords.resolve(
|
||||
pos + offset_of!(Self::Archived, coords),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => coords),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.coords);
|
||||
self.coords.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,23 +88,15 @@ where
|
||||
mod rkyv_impl {
|
||||
use super::Scale;
|
||||
use crate::base::SVector;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive, const D: usize> Archive for Scale<T, D> {
|
||||
type Archived = Scale<T::Archived, D>;
|
||||
type Resolver = <SVector<T, D> as Archive>::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.vector.resolve(
|
||||
pos + offset_of!(Self::Archived, vector),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => vector),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.vector);
|
||||
self.vector.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,23 +88,15 @@ where
|
||||
mod rkyv_impl {
|
||||
use super::Translation;
|
||||
use crate::base::SVector;
|
||||
use rkyv::{offset_of, project_struct, Archive, Deserialize, Fallible, Serialize};
|
||||
use rkyv::{out_field, Archive, Deserialize, Fallible, Serialize};
|
||||
|
||||
impl<T: Archive, const D: usize> Archive for Translation<T, D> {
|
||||
type Archived = Translation<T::Archived, D>;
|
||||
type Resolver = <SVector<T, D> as Archive>::Resolver;
|
||||
|
||||
fn resolve(
|
||||
&self,
|
||||
pos: usize,
|
||||
resolver: Self::Resolver,
|
||||
out: &mut core::mem::MaybeUninit<Self::Archived>,
|
||||
) {
|
||||
self.vector.resolve(
|
||||
pos + offset_of!(Self::Archived, vector),
|
||||
resolver,
|
||||
project_struct!(out: Self::Archived => vector),
|
||||
);
|
||||
unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) {
|
||||
let (fp, fo) = out_field!(out.vector);
|
||||
self.vector.resolve(pos + fp, resolver, fo);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user