tag | 0a0779f40e7cdc0dde5bf7672e543acf86c168bf | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Thu Feb 02 02:47:02 2023 -0800 |
object | f7df9e7204305fef367db3a18ae11ecb0a8ea0c5 |
aml_tz3_312511010 (9399027,com.google.android.tzdata3)
commit | f7df9e7204305fef367db3a18ae11ecb0a8ea0c5 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Jun 15 21:43:32 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Jun 15 21:43:32 2022 +0000 |
tree | 9348b0e0d4617d9e3bf58aff6a2a2d0db3e56b29 | |
parent | fea721041ca7c38a5e1e95f1733ec1a77ab68001 [diff] | |
parent | 4fa15855ccdce8238c39081894e507043138543c [diff] |
Snap for 8730993 from 4fa15855ccdce8238c39081894e507043138543c to mainline-tzdata3-release Change-Id: I5f5d1d3ae6371a8afeb12e971031768abf37bc99
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.