# `Beamchmark.Formatter`
[🔗](https://github.com/membraneframework/beamchmark/blob/v1.4.2/lib/beamchmark/formatter.ex#L1)

The module defines a  behaviour that will be used to format and output `Beamchmark.Suite`.
You can adopt this behaviour to implement custom formatters.

The module contains helper functions for validating and applying formatters defined in configuration
of `Beamchmark.Suite`.

# `options_t`

```elixir
@type options_t() :: Keyword.t()
```

Options given to formatters (defined by formatters authors).

# `t`

```elixir
@type t() :: module()
```

Represents a module implementing `Beamchmark.Formatter` behaviour.

# `format`

```elixir
@callback format(Beamchmark.Suite.t(), options_t()) :: any()
```

Takes the suite and transforms it into some internal representation, that later on will be passed to
`write/2`.

# `format`

```elixir
@callback format(Beamchmark.Suite.t(), Beamchmark.Suite.t(), options_t()) :: any()
```

Works like `format/2`, but can provide additional information by comparing the latest suite with the
previous one (passed as the second argument).

# `write`

```elixir
@callback write(any(), options_t()) :: :ok
```

Takes the return value of `format/1` or `format/2` and outputs it in a convenient form (stdout, file, UI...).

# `output`

```elixir
@spec output(Beamchmark.Suite.t()) :: :ok
```

Takes the suite and uses its formatters to output it. If the suite was configured with `compare?` flag enabled,
the previous suite will be also provided to the formatters.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
