Kind!() { /* proc-macro */ }Expand description
Generates the name of a Kind trait based on its signature.
This macro takes three parenthesized groups representing the signature:
- Lifetimes: A comma-separated list of lifetimes (e.g.,
('a, 'b)). - Types: A comma-separated list of types with optional bounds (e.g.,
(T, U: Display)). - Output Bounds: A
+-separated list of bounds on the output type (e.g.,(Display + Clone)).
§Example
ⓘ
// Generates the name for a Kind with:
// - 1 lifetime ('a)
// - 1 type parameter (T) bounded by Display and Clone
// - Output type bounded by Debug
let name = Kind!(('a), (T: Display + Clone), (Debug));§Limitations
Due to Rust syntax restrictions, this macro cannot be used directly in positions where a concrete path is expected by the parser, such as:
- Supertrait bounds:
trait MyTrait: Kind!(...) {}(Invalid) - Type aliases:
type MyKind = Kind!(...);(Invalid) - Trait aliases:
trait MyKind = Kind!(...);(Invalid)
In these cases, you must use the generated name directly (e.g., Kind_...).