one-of

version dependencies license ci

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

Documentation

Usage

```rust use oneof::oneof;

// either u32 or char let x: oneof!(u32, char) = 42.into(); asserteq!(Some(42u32), x.into()); assert_eq!(Option::::None, x.into());

// some type of integer let x: oneof!(i8, i16, i32, i64, u8, u16, u32, u64) = 42.into(); asserteq!(Option::::None, x.into()); asserteq!(Option::::None, x.into()); asserteq!(Some(42i32), x.into()); asserteq!(Option::::None, x.into()); asserteq!(Option::::None, x.into()); asserteq!(Option::::None, x.into()); asserteq!(Option::::None, x.into()); assert_eq!(Option::::None, x.into()); ```

Changelog

See CHANGELOG.md