#enums #generate #kinds #macro #proc-macro #return #name

macro generate-kinds

A macro to generate a kinds function for a given enum

4 releases (stable)

new 2.0.0 May 14, 2024
1.0.2 May 13, 2024
0.1.2 May 13, 2024
0.1.1 May 13, 2024
0.1.0 May 13, 2024

#335 in Procedural macros

Download history

188 downloads per month
Used in get-kinds

BSD-3-Clause

4KB

generate-kinds

A procedural macro to generate a function to return the name of the enum variant

How it works

The macro generates a function called kind for each enum it is applied on. The function will inherit the visibility of the enum. See the documentation for the kind function to see its usage.

Examples

See docs.rs

Dependencies

~315–770KB
~18K SLoC