implement From<NonZero<Int>> for Int

This commit is contained in:
csmoe
2018-09-15 09:34:36 +08:00
parent 994cdd9185
commit d5c1d15d31

View File

@@ -93,6 +93,13 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
}
#[stable(feature = "nonzero", since = "1.28.0")]
impl From<$Ty> for $Int {
fn from(nonzero: $Ty) -> Self {
nonzero.0 .0
}
}
impl_nonzero_fmt! {
(Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
}