oxide-generation-macros 0.1.0

Procedural macro for oxide-generation
Documentation

oxide-generation-macros

License: MIT OR Apache-2.0 crates.io docs.rs Rust: ^1.85.0

Procedural macro for oxide-generation.

This crate provides a procedural macro to help with creating oxide-generation instances.

For more information, see the documentation for impl_typed_generation_kinds!.

Examples

Basic usage:

use oxide_generation::TypedGenerationKind;
use oxide_generation_macros::impl_typed_generation_kinds;

impl_typed_generation_kinds! {
    kinds = {
        User = {},
        BusinessUnit = {},
    },
}

// This generates empty UserKind and BusinessUnitKind enums implementing
// TypedGenerationKind, 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 UserGeneration and BusinessUnitGeneration type aliases.
let user_generation = UserGeneration::new();
let business_unit_generation = BusinessUnitGeneration::new();

For more details and examples, see the documentation for impl_typed_generation_kinds!.

License

This project is available under the terms of either the Apache 2.0 license or the MIT license.