Skip to main content

Mojo trait

RepresentableCollectionElement

The RepresentableCollectionElement trait denotes a trait composition of the CollectionElement and Representable traits.

This is useful to have as a named entity since Mojo does not currently support anonymous trait compositions to constrain on CollectionElement & Representable in the parameter.

Implemented traits

AnyType, CollectionElement, Copyable, Movable, Representable

Methods

__copyinit__

__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.

__moveinit__

__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.

__repr__

__repr__(self: _Self) -> String

Get the string representation of the type instance, if possible, compatible with Mojo syntax.

Returns:

The string representation of the instance.