enum-unit

Crates.ioenum-unit
lib.rsenum-unit
version
sourcesrc
created_at2024-12-12 05:12:04.356676
updated_at2024-12-12 05:33:44.970643
descriptionGenerates unit-variant enums from existing enums.
homepage
repository
max_upload_size
id1480853
Cargo.toml error:TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Evan Schwartzentruber (splurf)

documentation

README

enum-unit

Description

Generates unit-variant enums from existing enums.

Example

use enum_unit::*;

#[derive(EnumUnit)]
enum Example {
    A(i16),
    B { id: u8 },
}

fn main() {
    let a = Example::A(-420);
    assert_eq!(ExampleUnit::A, a.into());

    let b = Example::B { id: 69 };
    assert_eq!(ExampleUnit::B, b.into());
}
Commit count: 0

cargo fmt