用法
pub const unsafe fn unchecked_mul(self, other:NonZeroIsize) -> NonZeroIsize
假设不会发生溢出,将两个非零整数相乘。溢出是未经检查的,即使结果将包装为非零值,溢出也是未定义的行为。只要 self * rhs > isize::MAX
或 self * rhs < isize::MIN
,该行为就未定义。
例子
#![feature(nonzero_ops)]
let two = NonZeroIsize::new(2)?;
let four = NonZeroIsize::new(4)?;
assert_eq!(four, unsafe { two.unchecked_mul(two) });
相关用法
- Rust core::num::NonZeroIsize.unsigned_abs用法及代码示例
- Rust core::num::NonZeroIsize.leading_zeros用法及代码示例
- Rust core::num::NonZeroIsize.saturating_pow用法及代码示例
- Rust core::num::NonZeroIsize.saturating_mul用法及代码示例
- Rust core::num::NonZeroIsize.checked_mul用法及代码示例
- Rust core::num::NonZeroIsize.checked_abs用法及代码示例
- Rust core::num::NonZeroIsize.overflowing_abs用法及代码示例
- Rust core::num::NonZeroIsize.abs用法及代码示例
- Rust core::num::NonZeroIsize.wrapping_abs用法及代码示例
- Rust core::num::NonZeroIsize.trailing_zeros用法及代码示例
- Rust core::num::NonZeroIsize.checked_pow用法及代码示例
- Rust core::num::NonZeroIsize.saturating_abs用法及代码示例
- Rust core::num::NonZeroIsize用法及代码示例
- Rust core::num::NonZeroI64.unchecked_mul用法及代码示例
- Rust core::num::NonZeroI32.checked_pow用法及代码示例
- Rust core::num::NonZeroI8.saturating_mul用法及代码示例
- Rust core::num::NonZeroI8.saturating_pow用法及代码示例
- Rust core::num::NonZeroI32.wrapping_abs用法及代码示例
- Rust core::num::NonZeroI16.checked_mul用法及代码示例
- Rust core::num::NonZeroI8.checked_abs用法及代码示例
注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 core::num::NonZeroIsize.unchecked_mul。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。