Registry / utility / int-enum

int-enum

JSON →
library1.2.0rscratesunverified

A derive macro for conversion between integer and enum types.

# Cargo.toml [dependencies] int-enum = "1.2.0"
INSTALL
IMPORT
SIG · INT-ENUM
I
int-enum
utilityrustv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IntEnum
use int_enum::IntEnum;

Converts an integer to an enum variant using the IntEnum derive macro.

use int_enum::IntEnum; #[derive(IntEnum, Debug, PartialEq)] #[repr(u8)] enum Color { Red = 0, Green = 1, Blue = 2, } fn main() { let color = Color::from_int(1).unwrap(); assert_eq!(color, Color::Green); println!("{:?}", color); }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
int-enum — cargo add int-enum · libregistry