MyPair
MyPair
Mojo struct 🡭
MyPair
@memory_only
struct MyPair[T: Intable]
A simple example struct.
This struct is re-exported by its parent package, so shows up where the user expects it due to the import path. It has aliases, parameters, fields and methods.
Linking to individual members is as easy as this:
Method: [.MyPair.dump], field: [.MyPair.first].
which gives:
Method: MyPair.dump
, field: MyPair.first
.
Aliases
MyInt = Int
: An example struct alias. Alias forMyIntAlias
Parameters
- T (
Intable
): TheMyPair
’s element type.
Fields
- first (
T
): First struct field. - second (
T
): Second struct field.
Implemented traits
AnyType
, UnknownDestructibility
Methods
➕ ➖__init__
fn __init__(out self, first: T, second: T)
Creates a new
Args:MyPair
.
- first (
T
): The value forMyPair.first
. - second (
T
): The value forMyPair.second
. - self (
Self
)
Returns:
Self
dump
fn dump(self)
- self (
Self
)
format
fn format(self, fmt: String) -> String
Formats this
A longer description of the method,
explaining how to use it.MyPair
.
Args:
- self (
Self
) - fmt (
String
): Desired output format.
Returns:
String
: A formatted string.
Raises:
When called with an unknown fmt
argument.
static_method
@staticmethod
fn static_method(self)
Details
Args:
- self (
Self
)