当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Rust u16.unstable_next_multiple_of用法及代码示例


本文简要介绍rust语言中 u16.unstable_next_multiple_of 的用法。

用法

pub const fn unstable_next_multiple_of(self, rhs: u16) -> u16

计算大于或等于 self 的最小值,它是 rhs 的倍数。

Panics

如果rhs 为 0 或操作导致溢出,此函数将出现紧急情况。

例子

基本用法:

#![feature(int_roundings)]
assert_eq!(16_u16.unstable_next_multiple_of(8), 16);
assert_eq!(23_u16.unstable_next_multiple_of(8), 24);

相关用法


注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 u16.unstable_next_multiple_of。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。