[][src]Macro genie_support::fallible_try_into

macro_rules! fallible_try_into {
    ($from:ident, $to:ty) => { ... };
}

Create a TryInto implementation for an ID container type that tries to returns its contained number as the given target type.

Example

use genie_support::fallible_try_into;
use std::convert::{TryFrom, TryInto};
struct Container(u16);
fallible_try_into!(Container, i16);
let num: i16 = Container(12).try_into().unwrap();
assert_eq!(num, 12i16);
assert!(i16::try_from(Container(50000u16)).is_err());