Skip to content

Commit

Permalink
Merge pull request #711 from John-Toohey/bytemuck
Browse files Browse the repository at this point in the history
Added `bytemuck` support
  • Loading branch information
KodrAus authored Oct 18, 2023
2 parents a8d2e1d + 2dad70d commit b8ebdee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit b8ebdee

Please sign in to comment.