#uint

    This package provides functionalities for handling 32-bit unsigned integers in MoonBit. To this end, it includes UInt's value-range constants, its default value, and conversion to Int64.

    #Basic Properties

    uint provides constants for UInt's value range and default value:

    ///|
    test "uint basics" {
    // Default value is 0
    inspect(@uint.default(), content="0")

    // Maximum and minimum values
    inspect(@uint.MAX_VALUE, content="4294967295")
    inspect(@uint.MIN_VALUE, content="0")
    }

    #Converting to Other Number Types

    UInt can be converted to Int64 when you need to work with signed 64-bit integers:

    ///|
    test "uint type conversion" {
    let num = 42U
    inspect(num.to_int64(), content="42")
    let large_num = 4294967295U // max value
    inspect(large_num.to_int64(), content="4294967295")
    }

    These conversion functions are also available as methods:

    ///|
    test "uint methods" {
    let num = 1000U

    // Using method syntax
    inspect(num.to_int64(), content="1000")
    }

    UInt

    Note

    UInt is a built-in type. The documentation may not be complete here. You can find all methods and implementations in the core/builtin and core/uint package.

    UInt::to_int64

    fn UInt::to_int64(self : UInt) -> Int64

    Convert to int64.
    impl Default for UInt

    MAX_VALUE

    let MAX_VALUE : UInt

    Max value constant for this type.

    MIN_VALUE

    let MIN_VALUE : UInt

    Min value constant for this type.

    default

    fn default() -> UInt

    same as UInt::default

    max_value

    #deprecated("Use `MAX_VALUE` instead")
    let max_value : UInt

    Max value constant for this type.

    min_value

    #deprecated("Use `MIN_VALUE` instead")
    let min_value : UInt

    Min value constant for this type.