From 0030062456317ab40303722c7e75dd10510007bb Mon Sep 17 00:00:00 2001 From: Sven Cattell Date: Mon, 19 Feb 2024 12:01:09 -0500 Subject: [PATCH 1/3] this should be it? --- Cargo.toml | 1 + src/bfloat.rs | 1 + src/binary16.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 764c6bf..7732b4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ num-traits = { version = "0.2.14", default-features = false, features = ["libm"] zerocopy = { version = "0.6.0", default-features = false, optional = true } rand = { version = "0.8.5", default-features = false, optional = true } rand_distr = { version = "0.4.3", default-features = false, optional = true } +rkyv = { version = "0.7", optional = true } [target.'cfg(target_arch = "spirv")'.dependencies] crunchy = "0.2.2" diff --git a/src/bfloat.rs b/src/bfloat.rs index a431135..c88c823 100644 --- a/src/bfloat.rs +++ b/src/bfloat.rs @@ -35,6 +35,7 @@ pub(crate) mod convert; #[derive(Clone, Copy, Default)] #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] +#[cfg_attr(feature = "rkyv", derive(rkyv::Serialize, rkyv::Deserialize))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))] diff --git a/src/binary16.rs b/src/binary16.rs index 9f0ae36..0776b33 100644 --- a/src/binary16.rs +++ b/src/binary16.rs @@ -34,6 +34,7 @@ pub(crate) mod arch; #[derive(Clone, Copy, Default)] #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] +#[cfg_attr(feature = "rkyv", derive(rkyv::Serialize, rkyv::Deserialize))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))] From 3c653f42b0230457810c29d1381faa6629655015 Mon Sep 17 00:00:00 2001 From: Sven Cattell Date: Mon, 19 Feb 2024 12:24:41 -0500 Subject: [PATCH 2/3] Missed the archive trait --- src/bfloat.rs | 2 +- src/binary16.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bfloat.rs b/src/bfloat.rs index c88c823..2cf5af7 100644 --- a/src/bfloat.rs +++ b/src/bfloat.rs @@ -35,7 +35,7 @@ pub(crate) mod convert; #[derive(Clone, Copy, Default)] #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] -#[cfg_attr(feature = "rkyv", derive(rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))] diff --git a/src/binary16.rs b/src/binary16.rs index 0776b33..2075186 100644 --- a/src/binary16.rs +++ b/src/binary16.rs @@ -34,7 +34,7 @@ pub(crate) mod arch; #[derive(Clone, Copy, Default)] #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] -#[cfg_attr(feature = "rkyv", derive(rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))] From 839a0aaaa219fe5d3a10c07f66c3a5650cd060fc Mon Sep 17 00:00:00 2001 From: Sven Cattell Date: Mon, 19 Feb 2024 12:39:48 -0500 Subject: [PATCH 3/3] resolver rename ro get past warning --- src/bfloat.rs | 1 + src/binary16.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bfloat.rs b/src/bfloat.rs index 2cf5af7..ae5624a 100644 --- a/src/bfloat.rs +++ b/src/bfloat.rs @@ -36,6 +36,7 @@ pub(crate) mod convert; #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] #[cfg_attr(feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv", archive(resolver = "Bf16Resolver"))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))] diff --git a/src/binary16.rs b/src/binary16.rs index 2075186..4bd575d 100644 --- a/src/binary16.rs +++ b/src/binary16.rs @@ -35,6 +35,7 @@ pub(crate) mod arch; #[repr(transparent)] #[cfg_attr(feature = "serde", derive(Serialize))] #[cfg_attr(feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv", archive(resolver = "F16Resolver"))] #[cfg_attr(feature = "bytemuck", derive(Zeroable, Pod))] #[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes))] #[cfg_attr(kani, derive(kani::Arbitrary))]