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 forAnyType
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
-
AnyType
: A trait for types that require lifetime management through destructors. -
UnknownDestructibility
: The most basic trait that all Mojo types extend by default.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!