IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

Format

struct Format

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

Fields​

  • ​value (StaticString): The format to print results.

Implemented traits​

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable, Writable

comptime members​

csv​

comptime csv = Format(StringSpan("csv"))

Comma separated values with no alignment.

table​

comptime table = Format(StringSpan("table"))

Table format with dynamically aligned columns.

tabular​

comptime tabular = Format(StringSpan("tabular"))

Comma separated values with dynamically aligned columns.

Methods​

__init__​

def __init__(out self, value: StringSpan)

Constructs a Format object from a string.

Args:

  • ​value (StringSpan): The format to print results.

__eq__​

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

write_to​

def write_to(self, mut writer: T)

Writes the format to a writer.

Args:

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

write_repr_to​

def write_repr_to(self, mut writer: T)

Writes the repr of this Format to a writer.

Args:

  • ​writer (T): The writer to write to.