Skip to main content

ToIntegerIndex

Trait ToIntegerIndex 

Source
pub trait ToIntegerIndex {
    // Required method
    fn to_integer_index(self) -> Option<u32>;
}
Expand description

Convert a value to u32 if the value can be an integer index and can be represented with u32.

Note that the max value of u32 is 2^32 - 1, which is smaller than the max value of safe integer 2^53 - 1.

If the value is a non-negative safe integer, it can be an integer index. https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-object-type

Required Methods§

Implementations on Foreign Types§

Source§

impl ToIntegerIndex for f64

Source§

impl ToIntegerIndex for BigInt

Implementors§