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 (StaticString): The format to print results.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, Writable

comptime members

csv

comptime csv = Format(StringSlice("csv"))

Comma separated values with no alignment.

table

comptime table = Format(StringSlice("table"))

Table format with dynamically aligned columns.

tabular

comptime tabular = Format(StringSlice("tabular"))

Comma separated values with dynamically aligned columns.

Methods

__init__

__init__(out self, value: StringSlice[value.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.

write_to

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

write_repr_to(self, mut writer: T)

Writes the repr of this Format to a writer.

Args:

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

Was this page helpful?