pub trait BoundedCastFromInt<T>: Sized {
// Required methods
fn wrapping_cast_from(value: T) -> Self;
fn saturating_cast_from(value: T) -> Self;
}🔬This is a nightly-only experimental API. (
integer_casts #157388)Expand description
Conversion between integers, wrapping around or saturating at the target type’s boundaries.
This trait cannot be implemented outside
core.Required Methods§
Sourcefn wrapping_cast_from(value: T) -> Self
🔬This is a nightly-only experimental API. (integer_casts #157388)
fn wrapping_cast_from(value: T) -> Self
integer_casts #157388)Converts value to this type, wrapping around at the boundary of the type.
Sourcefn saturating_cast_from(value: T) -> Self
🔬This is a nightly-only experimental API. (integer_casts #157388)
fn saturating_cast_from(value: T) -> Self
integer_casts #157388)Converts value to this type, saturating at the numeric bounds instead of overflowing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".