tag | 638b5f794ae811ead230a04c82f2c324a66d1092 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon May 06 10:13:40 2024 -0700 |
object | 832d4f0e56927372a5d52f87b7a0c5896c0324d8 |
Android security 14.0.0 release 8
commit | 832d4f0e56927372a5d52f87b7a0c5896c0324d8 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Mar 10 02:19:17 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Mar 10 02:19:17 2023 +0000 |
tree | 543441716e90d651a18c9a2ca72c0fd06a19c0b5 | |
parent | e733cec2dcb98057f80f867e9c7f2eee6b883c6d [diff] | |
parent | 0d049ce7a1b26adf7a0065e915d2fffe45884039 [diff] |
Snap for 9719949 from 0d049ce7a1b26adf7a0065e915d2fffe45884039 to udc-release Change-Id: I8c7dda07b7e9ea8c5f444a8656523f408a848318
cast
Ergonomic, checked cast functions for primitive types
extern crate cast; // `u8` and `u16` are checked cast functions, use them to cast from any numeric // primitive to `u8`/`u16` respectively use cast::{u8, u16, Error}; // Infallible operations, like integer promotion, are equivalent to a normal // cast with `as` assert_eq!(u16(0u8), 0u16); // Everything else will return a `Result` depending on the success of the // operation assert_eq!(u8(0u16), Ok(0u8)); assert_eq!(u8(256u16), Err(Error::Overflow)); assert_eq!(u8(-1i8), Err(Error::Underflow)); assert_eq!(u8(1. / 0.), Err(Error::Infinite)); assert_eq!(u8(0. / 0.), Err(Error::NaN));
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.