Skip to main content

Mojo struct

Format

struct Format

Defines a format for the benchmark output when printing or writing to a file.

Fields

  • value (StringSlice[StaticConstantOrigin]): The format to print results.

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, Stringable, UnknownDestructibility, Writable

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

csv

alias csv = Format("csv")

Comma separated values with no alignment.

table

alias table = Format("table")

Table format with dynamically aligned columns.

tabular

alias tabular = Format("tabular")

Comma separated values with dynamically aligned columns.

Methods

__init__

__init__(out self, value: StringSlice[origin])

Constructs a Format object from a string.

Args:

__eq__

__eq__(self, other: Self) -> Bool

Checks if two Format objects are equal.

Args:

  • other (Self): The Format to compare with.

Returns:

Bool: True if the two Format objects are equal, false otherwise.

__str__

__str__(self) -> String

Returns the string representation of the format.

Returns:

String: The string representation of the format.

write_to

write_to(self, mut writer: T)

Writes the format to a writer.

Args:

  • writer (T): The writer to write the Format to.

Was this page helpful?