Search results

There are no results.

std.fmt.ArrayFormatter

type pub ArrayFormatter

A type for making it easy to format array-like values.

Instance methods

finish

Show source code
Hide source code
fn pub mut finish {
  @formatter.write(']')
}
fn pub mut finish

Finishes formatting the tuple.

This method is used instead of a Drop implementation, otherwise a call chain (e.g. x.array.value(10)) results in a drop error, as the final reference returned by field would outlive the ArrayFormatter.

value

Show source code
Hide source code
fn pub mut value[T: Format](value: ref T) -> mut ArrayFormatter {
  if @fields > 0 { @formatter.write(', ') }

  @formatter.descend(fn { value.fmt(@formatter) })
  @fields += 1
  self
}
fn pub mut value[T: Format](value: ref T) -> mut ArrayFormatter

Adds a new formatted value to the output.