enum_const 0.1.1

enum const trait
Documentation
  • Coverage
  • 25%
    1 out of 4 items documented1 out of 3 items with examples
  • Size
  • Source code size: 13.37 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 251.56 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • andeya/enum_const
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andeya

enum_const

enum const trait

usage

use enum_const::EnumConst;

#[derive(EnumConst, PartialEq, Debug)]
enum Foo {
    X = 1,
    Y = 2,
    Z,
}

#[test]
fn it_works() {
    assert_eq!(Some(Foo::X), Foo::from_const_isize(1));
    assert_eq!(Some(1isize), Foo::X.get_const_isize());
}