Merge pull request #711 from John-Toohey/bytemuck

Added `bytemuck` support
This commit is contained in:
Ashley Mannix 2023-10-18 16:56:17 +10:00 committed by GitHub
commit b8ebdee9b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,7 @@ name: Continuous integration
env:
VERSION_FEATURES: "v1 v3 v4 v5 v6 v7 v8"
DEP_FEATURES: "slog serde arbitrary borsh zerocopy"
DEP_FEATURES: "slog serde arbitrary borsh zerocopy bytemuck"
on:
pull_request:

View File

@ -71,6 +71,13 @@ fast-rng = ["rng", "rand"]
sha1 = ["sha1_smol"]
md5 = ["md-5"]
# Public: Used in trait impls on `Uuid`
[dependencies.bytemuck]
version = "1.14.0"
optional = true
features = ["derive"]
# Public: Used in trait impls on `Uuid`
[dependencies.serde]
default-features = false

View File

@ -108,6 +108,7 @@
//! * `fast-rng` - uses a faster algorithm for generating random UUIDs.
//! This feature requires more dependencies to compile, but is just as suitable for
//! UUIDs as the default algorithm.
//! * `bytemuck` - adds a `Pod` trait implementation to `Uuid` for byte manipulation
//!
//! # Unstable features
//!
@ -447,6 +448,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 {