Macro to represent a type that can be converted either From
or Into
the given types
This crate only works on the nightly version of Rust
```rust use oneof::{case, oneof};
// either u32
or char
let x: oneof!(u32, char) = 42.into();
asserteq!(Some(42u32), x.into());
assert_eq!(Option::
// some type of integer
let x: oneof!(i8, i16, i32, i64, u8, u16, u32, u64) = 42.into();
asserteq!(Option::
// case macro is the );
``` See CHANGELOG.mdmatch
keyword for one_of
types
case!(// &str
s if s.starts_with("Hello, ") => {
assert_eq!(&s[7 ..], "world!");
}
_ => {
panic!("not other strings");
};
// i64
_ => {
panic!("not i64");
};
Changelog