TypeSum
Utilities for working with enums, primarily aimed at sum types.
What's in it
#[sumtype]
: Generate all the functions and impls you could ever need for a sum type
If you want the full list it's in the docs for the attribute
use ;
let mut v = Int;
assert!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Individual variants can be ignored with #[sumtype(ignore)]
use sumtype;
let v = Empty;
v.as_empty; // doesn't exist
It can even work with overlapping types
use sumtype;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
#[kinded]
: Generate kind aliases for an enum
use kinded;
let look = ImAUnit;
assert_eq!;