| Crates.io | newtype-uuid-macros |
| lib.rs | newtype-uuid-macros |
| version | 0.1.0 |
| created_at | 2025-08-19 20:37:29.909745+00 |
| updated_at | 2025-08-19 20:37:29.909745+00 |
| description | Procedural macro for newtype-uuid |
| homepage | |
| repository | https://github.com/oxidecomputer/newtype-uuid |
| max_upload_size | |
| id | 1802449 |
| size | 39,222 |
Procedural macro for newtype-uuid.
This crate provides a procedural macro to help with creating
newtype-uuid instances.
For more information, see the documentation for impl_typed_uuid_kinds!.
Basic usage:
use newtype_uuid::TypedUuidKind;
use newtype_uuid_macros::impl_typed_uuid_kinds;
impl_typed_uuid_kinds! {
kinds = {
User = {},
BusinessUnit = {},
},
}
// This generates empty UserKind and BusinessUnitKind enums implementing
// TypedUuidKind, with the tags "user" and "business_unit" respectively.
// Tags are snake_case versions of type names.
assert_eq!(UserKind::tag().as_str(), "user");
assert_eq!(BusinessUnitKind::tag().as_str(), "business_unit");
// The macro also generates UserUuid and BusinessUnitUuid type aliases.
let user_uuid = UserUuid::new_v4();
let business_unit_uuid = BusinessUnitUuid::new_v4();
For more details and examples, see the documentation for
impl_typed_uuid_kinds!.
This project is available under the terms of either the Apache 2.0 license or the MIT license.