Skip to main content

Crate oxide_generation_macros

Crate oxide_generation_macros 

Source
Expand description

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 UserGenerationKind and BusinessUnitGenerationKind
// enums implementing TypedGenerationKind, with the tags "user" and
// "business_unit" respectively. Tags are snake_case versions of type names.
assert_eq!(UserGenerationKind::TAG.as_str(), "user");
assert_eq!(BusinessUnitGenerationKind::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!.

Macros§

impl_typed_generation_kinds
A function-like procedural macro for implementing typed generation kinds.