From 646dc1a82e32af73949852366443508725e9c0dc Mon Sep 17 00:00:00 2001 From: John Toohey Date: Sun, 15 Oct 2023 12:12:14 +0100 Subject: [PATCH] Added bytemuck support --- Cargo.toml | 3 +++ src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 1f14cf31..1ac7f5cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,6 +71,9 @@ fast-rng = ["rng", "rand"] sha1 = ["sha1_smol"] md5 = ["md-5"] +[dependencies] +bytemuck = { version = "1.14.0", optional = true, features = ["derive"] } + # Public: Used in trait impls on `Uuid` [dependencies.serde] default-features = false diff --git a/src/lib.rs b/src/lib.rs index c654d3cd..b684b259 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -447,6 +447,10 @@ pub enum Variant { derive(borsh::BorshDeserialize, borsh::BorshSerialize) )] #[repr(transparent)] +#[cfg_attr( + feature = "bytemuck", + derive(bytemuck::Zeroable, bytemuck::Pod, bytemuck::TransparentWrapper) +)] pub struct Uuid(Bytes); impl Uuid {