Workspace.Graph.Formatter behaviour (Workspace v0.2.1)

View Source

A behaviour for defining custom formatters for using with mix workspace.graph.

A formatter is responsible for visualizing the workpsace graph.

Summary

Types

A module implementing the Workspace.Graph.Formatter behaviour.

Callbacks

Renders the given workspace graph.

Functions

Formats the given workspace using the provided formatter and options.

Types

formatter()

@type formatter() :: module()

A module implementing the Workspace.Graph.Formatter behaviour.

Callbacks

render(graph, workspace, opts)

@callback render(
  graph :: :digraph.graph(),
  workspace :: Workspace.State.t(),
  opts :: keyword()
) :: :ok

Renders the given workspace graph.

The formatter is responsible for printing any console output or generating any output file, based on the given opts.

The graph is expected to be the :digraph.graph() to be printed. The graph may be a subgraph of the full workspace graph.

Options are arbitrary and any formatter can support custom options.

Functions

format(formatter, workspace, opts)

@spec format(
  formatter :: formatter(),
  workspace :: Workspace.State.t(),
  opts :: keyword()
) :: :ok

Formats the given workspace using the provided formatter and options.

Options