Kinded 0.5.0 – Generate Rust Enum Kind Types Without Boilerplate
Serhii Potapov February 03, 2026 #rust #enum #macro #kindedI'm happy to announce the release of Kinded v0.5.0! This update brings several useful features, including const support for the kind() method and flexible attribute handling. You can find the full release notes on GitHub.
What is Kinded?
Kinded is a Rust crate that generates "kind" enums from your existing Rust enums using a derive macro. A kind enum is a simplified version of your enum that contains only the variant names, without any associated data.
This is useful when you need to work with enum variants as values — for example, in configuration, pattern matching, or when you need to compare or display variant names without caring about the data they hold.
Quick Example
Here's how simple it is to use Kinded:
use Kinded;
let drink = Coffee;
assert_eq!;
The #[derive(Kinded)] macro automatically generates a DrinkKind enum and a kind() method. Behind the scenes, you get something like this:
The generated kind enum comes with implementations of Debug, Clone, Copy, PartialEq, Eq, Display, FromStr, and From traits out of the box.
What's New in v0.5.0
Const kind() Method
The kind() method is now a const fn, allowing it to be used in const contexts:
use Kinded;
const ACTIVE_KIND: StatusKind = Active.kind;
This is particularly useful when you need to work with enum kinds at compile time, such as in const assertions or static configurations.
The skip_derive Attribute
Sometimes you need to opt out of certain default trait implementations. For example, when using Kinded with crates like enumset that provide their own trait implementations, you can use skip_derive(..) to avoid conflicts:
use Kinded;
// Display and FromStr are not implemented for TaskKind
// You can provide your own custom implementations if needed
The following traits can be skipped:
- Derived traits:
Debug,Clone,Copy,PartialEq,Eq - Implemented traits:
Display,FromStr,From
Generic Attributes with attrs
If you're using derive traits from other libraries like Serde, you might want to add extra attributes specific to those libraries. The new attrs attribute makes this possible:
use Kinded;
use Serialize;
let json_value = to_value;
assert_eq!;
Per-Variant Attributes
You can also apply attributes to individual variants of the generated kind enum:
use Kinded;
// Medium is the default
assert_eq!;
This combines well with the rename attribute introduced in v0.4.1:
Other Features
Kinded offers additional capabilities that make working with Rust enums more convenient:
- Get all variants: The kind enum provides an
::all()method returning an array of all variants - Custom kind names: Use
#[kinded(kind = MyCustomName)]to customize the generated enum name - Display formatting: Customize how variants are displayed with options like
snake_case,camelCase,kebab-case, and more - Flexible parsing: The
FromStrimplementation tries multiple case formats when parsing - Generic enum support: Works with enums that have generic type parameters
- no_std support: The crate works in no_std environments