tag | 5441f13f08020b46a4e1bb4a383304f2d787c8dd | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed Jul 14 14:04:10 2021 -0700 |
object | cce3c7a643f5782cbccd6dc7693c5cbada824778 |
Android S Beta 3
commit | cce3c7a643f5782cbccd6dc7693c5cbada824778 | [log] [tgz] |
---|---|---|
author | Joel Galenson <jgalenson@google.com> | Tue May 25 12:24:52 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue May 25 12:24:52 2021 +0000 |
tree | 0dc298b16ac0d9e721e41cabd2129379d4b640a4 | |
parent | b8ffbc179173cf3ba730886518294dc34f9c1695 [diff] | |
parent | 80bf6a831306593c9b832d499bcd7ec5bed85d41 [diff] |
Upgrade rust/crates/cast to 0.2.6 am: 80bf6a8313 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/cast/+/1712590 Change-Id: I7479ae2b847fe6694bb5aa2cc1c52386ec72864b
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.