core::num::impl usize
本页内容
72abs_diffchecked_addchecked_divchecked_ilogchecked_ilog10checked_ilog2checked_mulchecked_negchecked_next_power_of_twochecked_powchecked_remchecked_shlchecked_shrchecked_subcount_onescount_zerosdiv_eucliddiv_floorfrom_befrom_be_bytesfrom_be_bytesfrom_lefrom_le_bytesfrom_le_bytesfrom_ne_bytesfrom_ne_bytesilogilog10ilog2is_power_of_twoisqrtleading_onesleading_zerosnext_power_of_twooverflowing_addoverflowing_divoverflowing_muloverflowing_negoverflowing_powoverflowing_removerflowing_shloverflowing_shroverflowing_subpowrem_euclidrem_floorrotate_leftrotate_rightsaturating_addsaturating_mulsaturating_powsaturating_subswap_bytesto_beto_be_bytesto_be_bytesto_leto_le_bytesto_le_bytesto_ne_bytesto_ne_bytestrailing_onestrailing_zeroswrapping_addwrapping_divwrapping_mulwrapping_negwrapping_powwrapping_remwrapping_shlwrapping_shrwrapping_sub
API 参考只有英文版,由标准库源代码中的英文文档注释生成。
impl usize
The smallest value.
The largest value.
The width in bits.
The bytes, least significant first.
The bytes, most significant first.
The bytes in the target's byte order.
The number of
bytes, least significant first.The number of
bytes, most significant first.The number of
bytes, in the target's byte order.The smallest value.
The largest value.
The width in bits.
The bytes, least significant first.
The bytes, most significant first.
The bytes in the target's byte order.
The number of
bytes, least significant first.The number of
bytes, most significant first.The number of
bytes, in the target's byte order.self + rhs, wrapping around at the bounds.self - rhs, wrapping around at the bounds.self * rhs, wrapping around at the bounds.The number of one bits.
The number of zero bits.
The number of zero bits above the highest one bit.
The number of zero bits below the lowest one bit.
The number of one bits above the highest zero bit.
The number of one bits below the lowest zero bit.
The bits shifted left by
n, those shifted out coming back on the right.The bits shifted right by
n, those shifted out coming back on the left.The bytes in reverse order.
selfin big-endian byte order (unchanged on a big-endian target).selfin little-endian byte order (unchanged on a little-endian target).The number whose big-endian bytes are
x.The number whose little-endian bytes are
x.self + rhs, ornoneon overflow.self - rhs, ornoneon overflow.self * rhs, ornoneon overflow.self / rhs, ornonewhenrhsis 0.self % rhs, ornonewhenrhsis 0.-self:0for 0,nonefor any other value.self << n, ornonewhennis at leastBITS.self >> n, ornonewhennis at leastBITS.selfto theexp, ornoneon overflow.self / rhs(it never overflows). Panics whenrhsis 0.self % rhs(it never overflows). Panics whenrhsis 0.0 - self, wrapping around.self << (n % BITS).self >> (n % BITS).selfto theexp, wrapping around at the bounds.self + rhs, clamped toMIN..=MAX.self - rhs, clamped toMIN..=MAX.self * rhs, clamped toMIN..=MAX.selfto theexp, clamped toMIN..=MAX.self + rhswrapped, and whether it overflowed.self - rhswrapped, and whether it overflowed.self * rhswrapped, and whether it overflowed.self / rhsandfalse(it never overflows). Panics whenrhsis 0.self % rhsandfalse(it never overflows). Panics whenrhsis 0.0 - selfwrapped, and whether it overflowed (any value but 0).self << (n % BITS), and whethernwas at leastBITS.self >> (n % BITS), and whethernwas at leastBITS.selfto theexpwrapped, and whether it overflowed.selfto theexp; overflow is the arithmetic's (a panic; a wrap with overflow checks off).|self - rhs|, as the unsigned type of the same width; never overflows.Quotient rounded toward negative infinity:
/for an unsigned type (Python's//).The remainder with the divisor's sign:
%for an unsigned type (Python's%).self / rhs(the same as/for unsigned numbers). Panics whenrhsis 0.self % rhs(the same as%for unsigned numbers). Panics whenrhsis 0.Integer square root (rounded down).
truewhen exactly one bit is set.The smallest power of two
>= self; panics pastMAX.The smallest power of two
>= self, ornonepastMAX.floor(log2(self)); panics unlessself > 0.floor(log10(self)); panics unlessself > 0.floor(log(self, base)); panics unlessself > 0andbase >= 2.floor(log2(self)), ornoneunlessself > 0.floor(log10(self)), ornoneunlessself > 0.floor(log(self, base)), ornoneunlessself > 0andbase >= 2.