本文簡要介紹rust語言中 std::num::NonZeroI64.saturating_mul
的用法。
用法
pub const fn saturating_mul(self, other: NonZeroI64) -> NonZeroI64
將兩個非零整數相乘。溢出時返回 i64::MAX
。
例子
#![feature(nonzero_ops)]
let two = NonZeroI64::new(2)?;
let four = NonZeroI64::new(4)?;
let max = NonZeroI64::new(i64::MAX)?;
assert_eq!(four, two.saturating_mul(two));
assert_eq!(max, four.saturating_mul(max));
相關用法
- Rust NonZeroI64.saturating_pow用法及代碼示例
- Rust NonZeroI64.saturating_abs用法及代碼示例
- Rust NonZeroI64.wrapping_abs用法及代碼示例
- Rust NonZeroI64.checked_abs用法及代碼示例
- Rust NonZeroI64.trailing_zeros用法及代碼示例
- Rust NonZeroI64.abs用法及代碼示例
- Rust NonZeroI64.checked_mul用法及代碼示例
- Rust NonZeroI64.overflowing_abs用法及代碼示例
- Rust NonZeroI64.leading_zeros用法及代碼示例
- Rust NonZeroI64.checked_pow用法及代碼示例
- Rust NonZeroI64.unsigned_abs用法及代碼示例
- Rust NonZeroI64.unchecked_mul用法及代碼示例
- Rust NonZeroI64用法及代碼示例
- Rust NonZeroI128.saturating_pow用法及代碼示例
- Rust NonZeroI32.trailing_zeros用法及代碼示例
- Rust NonZeroI8.saturating_pow用法及代碼示例
- Rust NonZeroIsize.wrapping_abs用法及代碼示例
- Rust NonZeroI16.saturating_abs用法及代碼示例
- Rust NonZeroI16.leading_zeros用法及代碼示例
- Rust NonZeroI8.unchecked_mul用法及代碼示例
- Rust NonZeroIsize.checked_mul用法及代碼示例
- Rust NonZeroI128.abs用法及代碼示例
- Rust NonZeroI32用法及代碼示例
- Rust NonZeroI16.trailing_zeros用法及代碼示例
- Rust NonZeroIsize.checked_abs用法及代碼示例
注:本文由純淨天空篩選整理自rust-lang.org大神的英文原創作品 std::num::NonZeroI64.saturating_mul。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。