Skip to main content

Mojo struct

Attr

A generic object's attributes are set on construction, after which the attributes can be read and modified, but no attributes may be removed or added.

Fields

  • key (StringLiteral): The name of the attribute.
  • value (object): The value of the attribute.

Implemented traits

AnyType

Methods

__init__

__init__(inout self: Self, key: StringLiteral, owned value: object)

Initializes the attribute with a key and value.

Args:

  • key (StringLiteral): The string literal key.
  • value (object): The object value of the attribute.