Skip to main content

Mojo package

builtin

Language foundation: built-in types, traits, and fundamental operations.

The builtin package provides the core types, traits, and operations that form the foundation of the Mojo language. It defines fundamental types like integers, booleans, and strings, essential traits for type behavior (Copyable, Movable, Comparable), and basic operations used throughout all Mojo code. Most symbols from this package are automatically available without explicit imports through the prelude.

This package is implicitly imported. It defines the core vocabulary of Mojo programming that every developer uses without thinking about imports. Library authors implement traits from this package to integrate custom types with language features.

Modules

  • anytype: Defines the core traits for object lifetime management in Mojo.
  • bool: Implements the Bool class.
  • breakpoint: This module includes the builtin breakpoint function.
  • builtin_slice: Implements slice.
  • comparable:
  • constrained: Implements compile-time constraints.
  • coroutine: Implements classes and methods for coroutines.
  • debug_assert: Implements run-time assertions.
  • device_passable:
  • dtype: Implements the DType class.
  • error: Implements the Error class.
  • float_literal: Implements the FloatLiteral class.
  • floatable: Implements the Floatable and FloatableRaising traits.
  • format_int: Provides the hex and bin functions.
  • globals: Utilities for working with global constants.
  • identifiable: Defines the Identifiable trait for identity-based comparisons.
  • int: Implements the Int class.
  • int_literal: Implements the IntLiteral class.
  • len: Provides the len() function and its associated traits.
  • math: Defines basic math functions for use in the open source parts of the standard library since the math package is currently closed source and cannot be depended on in the open source parts of the standard library.
  • none: Defines the builtin NoneType.
  • range: Implements a 'range' call.
  • rebind: Implements type rebind/trait downcast
  • repr: Provide the repr function.
  • reversed: Provides the reversed function for reverse iteration over collections.
  • simd: Implements SIMD primitives and abstractions.
  • sort: Implements the built-in sort function.
  • str: Provides the Stringable and StringableRaising traits.
  • string_literal: Implements the StringLiteral struct.
  • swap: Implements the built-in swap function.
  • tuple: Implements the Tuple type.
  • type_aliases: Defines some type aliases.
  • uint: Implements the UInt class.
  • value: Defines core value traits.
  • variadics: Implements the VariadicList and VariadicPack types.

Was this page helpful?