IdentifiableCollectionElement
IdentifiableCollectionElement
Mojo trait 🡭
IdentifiableCollectionElement
A Type that is uniquely identifiable via a given ID.
By convention, the ID should contain the package, module,
and class name. For example, the ID for a MyStruct
in the
module my_module
in the package my_package
would be
assigned as follows:
struct MyStruct(IdentifiableCollectionElement):
alias id = TypeId("my_package.my_module.MyStruct")
If the ID is used in a limited context only, you can
set the id
manually by passing an integer to the constructor.
Implemented traits
AnyType
, CollectionElement
, Copyable
, Movable
, UnknownDestructibility
Methods
Expand all Collapse all__copyinit__
@staticmethod
fn __copyinit__(out self: _Self, existing: _Self, /)
Create a new instance of the value by copying an existing one.
Args:
- existing (
_Self
): The value to copy. - self (
_Self
)
Returns:
_Self
__moveinit__
@staticmethod
fn __moveinit__(out self: _Self, owned existing: _Self, /)
Create a new instance of the value by moving the value of another.
Args:
- existing (
_Self
): The value to move. - self (
_Self
)
Returns:
_Self