Skip to content

Commit

Permalink
feat: upgrade zerocopy to 0.8
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
  • Loading branch information
mkroening committed Oct 13, 2024
1 parent ebc29bc commit 9148eec
Show file tree
Hide file tree
Showing 7 changed files with 402 additions and 271 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
num_enum = { version = "0.7", default-features = false, optional = true }
zerocopy = { version = "0.7", default-features = false, optional = true }
zerocopy-derive = { version = "0.7", optional = true }
zerocopy = { version = "0.8", default-features = false, optional = true }
zerocopy-derive = { version = "0.8", optional = true }

[features]
default = []
Expand Down
2 changes: 1 addition & 1 deletion bindgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gen() {
--with-derive-partialeq \
--with-derive-eq \
--with-attribute-custom-enum '.*=#[cfg_attr(feature = "num_enum", derive(num_enum::IntoPrimitive,num_enum::TryFromPrimitive,num_enum::UnsafeFromPrimitive,))]' \
--with-attribute-custom-struct '.*=#[cfg_attr(feature = "zerocopy", derive(zerocopy_derive::FromZeroes,zerocopy_derive::FromBytes,zerocopy_derive::AsBytes,))]' \
--with-attribute-custom-struct '.*=#[cfg_attr(feature = "zerocopy", derive(zerocopy_derive::KnownLayout,zerocopy_derive::Immutable,zerocopy_derive::FromBytes,zerocopy_derive::IntoBytes,))]' \
"$@"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff --git a/src/linux.rs b/src/linux.rs
--- a/src/linux.rs
+++ b/src/linux.rs
@@ -1,7 +1,15 @@
@@ -1,7 +1,16 @@
/* automatically generated by rust-bindgen 0.70.1 */

-#[repr(C)]
Expand All @@ -10,9 +10,10 @@ diff --git a/src/linux.rs b/src/linux.rs
+#[cfg_attr(
+ feature = "zerocopy",
+ derive(
+ zerocopy_derive::FromZeroes,
+ zerocopy_derive::KnownLayout,
+ zerocopy_derive::Immutable,
+ zerocopy_derive::FromBytes,
+ zerocopy_derive::AsBytes,
+ zerocopy_derive::IntoBytes,
+ )
+)]
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
Expand All @@ -21,7 +22,7 @@ diff --git a/src/linux.rs b/src/linux.rs
diff --git a/src/macos.rs b/src/macos.rs
--- a/src/macos.rs
+++ b/src/macos.rs
@@ -1,7 +1,15 @@
@@ -1,7 +1,16 @@
/* automatically generated by rust-bindgen 0.70.1 */

-#[repr(C)]
Expand All @@ -30,9 +31,10 @@ diff --git a/src/macos.rs b/src/macos.rs
+#[cfg_attr(
+ feature = "zerocopy",
+ derive(
+ zerocopy_derive::FromZeroes,
+ zerocopy_derive::KnownLayout,
+ zerocopy_derive::Immutable,
+ zerocopy_derive::FromBytes,
+ zerocopy_derive::AsBytes,
+ zerocopy_derive::IntoBytes,
+ )
+)]
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
//! - [`num_enum::TryFromPrimitive`]
//! - [`num_enum::UnsafeFromPrimitive`]
//! - `zerocopy` derives the following traits for all structs:
//! - [`zerocopy::FromZeroes`]
//! - [`zerocopy::KnownLayout`]
//! - [`zerocopy::Immutable`]
//! - [`zerocopy::FromBytes`]
//! - [`zerocopy::AsBytes`]
//! - [`zerocopy::IntoBytes`]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
Expand Down
Loading

0 comments on commit 9148eec

Please sign in to comment.