diff options
| author | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-09-15 09:34:36 +0800 |
|---|---|---|
| committer | csmoe <35686186+csmoe@users.noreply.github.com> | 2018-09-15 09:34:36 +0800 |
| commit | d5c1d15d31dc6164ac67e71526fe15f23a8014e7 (patch) | |
| tree | 425115aadc0a24876ccdca997687d1ca3104c5dc /src/libcore/num | |
| parent | 994cdd918589535d705177545bf503cd0c3c5148 (diff) | |
| download | rust-d5c1d15d31dc6164ac67e71526fe15f23a8014e7.tar.gz rust-d5c1d15d31dc6164ac67e71526fe15f23a8014e7.zip | |
implement From<NonZero<Int>> for Int
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 12da0455cc5..82a30864fd2 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -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 } |
