Skip to content

Commit d5c1d15

Browse files
committed
implement From<NonZero<Int>> for Int
1 parent 994cdd9 commit d5c1d15

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcore/num/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
9393

9494
}
9595

96+
#[stable(feature = "nonzero", since = "1.28.0")]
97+
impl From<$Ty> for $Int {
98+
fn from(nonzero: $Ty) -> Self {
99+
nonzero.0 .0
100+
}
101+
}
102+
96103
impl_nonzero_fmt! {
97104
(Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty
98105
}

0 commit comments

Comments
 (0)