method i8.saturating_mul
Multiplication that stops at the nearest bound of the type instead of panicking.
Example:
fn main() io {
let max: i8 = 127
let min: i8 = -128
print("{max.saturating_mul(2)}")
}Вывод
127
pub(api) fn saturating_mul(o: i8) -> i8Сложность. O(1).
С версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
o | i8 |
Возвращает
i8
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/core/numbers.oxl:1212