Skip to main content
Log in

Mojo struct

Format

struct Format

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

Aliases

  • csv = "csv": Comma separated values with no alignment.
  • tabular = "tabular": Comma separated values with dynamically aligned columns.
  • table = "table": Table format with dynamically aligned columns.

Fields

  • value (StringLiteral): The format to print results.

Implemented traits

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

Methods

__init__

@implicit __init__(out self, value: StringLiteral)

Constructs a Format object from a string literal.

Args:

  • value (StringLiteral): The format to print results.

__init__(out self, value: String)

Constructs a Format object from a string.

Args:

  • value (String): The format to print results.

__eq__

__eq__(self, other: Self) -> Bool

Checks if two Format objects are equal.

Args:

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

Returns:

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

__str__

__str__(self) -> String

Returns the string representation of the format.

Returns:

The string representation of the format.

write_to

write_to[W: Writer](self, mut writer: W)

Writes the format to a writer.

Parameters:

  • W (Writer): A type conforming to the Writable trait.

Args:

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