uuid-enum 0.1.0

UUID-based enums.
Documentation
  • Coverage
  • 100%
    1 out of 1 items documented1 out of 1 items with examples
  • Size
  • Source code size: 34.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 243.7 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • metastable-void/uuid-enum
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • metastable-void

uuid-enum

uuid-enum is a tiny facade crate that re-exports the uuid_enum derive macro and the uuid crate so you can describe discriminants for enums with stable UUIDs in one dependency.

Installation

[dependencies]
uuid-enum = "0.1"

Usage

use uuid_enum::uuid_enum;

#[uuid_enum]
pub enum AccountGrant {
    #[uuid("bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb")]
    Owner,
    #[uuid("cccccccc-cccc-cccc-cccc-cccccccccccc")]
    Manage,
}

The macro injects impls that let you convert between the enum variants and uuid::Uuid values, while uuid-enum also exposes the uuid crate (and its Uuid type) under the same namespace for convenience.

License

Licensed under either the Apache License 2.0 or the Mozilla Public License 2.0 at your option.