IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo trait

OptionallyStaticInt

Trait for integer values that may be statically known at compile time.

Implementors carry a comptime static_value that is Some when the integer is a compile-time constant and None when it is a runtime value. This lets callers specialise code at compile time (eliminating kernel arguments) while retaining a uniform runtime interface through __int__ and as_uint32().

Implemented traits​

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Intable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

static_value​

comptime static_value

Required methods​

as_uint32​

def as_uint32(self) -> UInt32

Returns:

UInt32

Was this page helpful?