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 = StringSlice("csv"): Comma separated values with no alignment.
  • tabular = StringSlice("tabular"): Comma separated values with dynamically aligned columns.
  • table = StringSlice("table"): Table format with dynamically aligned columns.

Fields

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

Implemented traits

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

Methods

__init__

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

Constructs a Format object from a string.

Args:

  • value (StringSlice[origin]): 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.