Add From<bool> for int types
This commit is contained in:
parent
aa094a43cc
commit
8c3bdcc35a
1 changed files with 14 additions and 0 deletions
|
@ -4454,6 +4454,20 @@ macro_rules! impl_from {
|
|||
}
|
||||
}
|
||||
|
||||
// Bool -> Any
|
||||
impl_from! { bool, u8, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, u16, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, u32, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, u64, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, u128, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, usize, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, i8, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, i16, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, i32, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, i64, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, i128, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
impl_from! { bool, isize, #[stable(feature = "from_bool", since = "1.28.0")] }
|
||||
|
||||
// Unsigned -> Unsigned
|
||||
impl_from! { u8, u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
|
||||
impl_from! { u8, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue