Skip to main content
Log in

Mojo module

anytype

Defines the core traits for object lifetime management in Mojo.

This module provides the foundational traits that define how objects are created, managed and destroyed in Mojo:

  • UnknownDestructibility: The most basic trait that all types extend by default. Types with this trait have no destructor and no lifetime management.

  • AnyType: The base trait for types that require lifetime management through destructors. Any type that needs cleanup when it goes out of scope should implement this trait.

  • ImplicitlyDestructible: An alias for AnyType to help with the transition to linear types. Use this when you want to be explicit about a type having a destructor.

These traits are built into Mojo and do not need to be imported.

Aliases

  • ImplicitlyDestructible = AnyType:

Traits