def_kind!() { /* proc-macro */ }Expand description
Defines a new Kind trait.
This macro generates a trait definition for a Higher-Kinded Type signature.
§Syntax
ⓘ
def_kind!(
type AssocName<Params>: Bounds;
// ...
)§Parameters
Associated Types: A list of associated type definitions (e.g.,type Of<T>;) that define the signature of the Kind.
§Generates
A public trait definition with a unique name derived from the signature (format: Kind_{hash}).
§Examples
ⓘ
// Invocation
def_kind!(type Of<T>;);
// Expanded code
pub trait Kind_... { // e.g., Kind_a1b2c3d4e5f67890
type Of<T>;
}ⓘ
// Invocation
def_kind!(type Of<'a, T: Display>: Debug;);
// Expanded code
pub trait Kind_... {
type Of<'a, T: Display>: Debug;
}ⓘ
// Invocation
def_kind!(
type Of<T>;
type SendOf<T>: Send;
);
// Expanded code
pub trait Kind_... {
type Of<T>;
type SendOf<T>: Send;
}