Macro impl_newtype_from_into
Source macro_rules! impl_newtype_from_into {
($newtype:ty [<=>] $inner:ty $(,)?) => { ... };
}
Expand description
Implement From and Into for a newtype struct.
ยงExamples
use impl_more::impl_newtype_from_into;
struct Checked(bool);
impl_newtype_from_into!(Checked [<=>] bool);
let foo = Checked::from(true);
assert_eq!(foo.0, true);
let foo = bool::from(Checked(false));
assert_eq!(foo, false);