ASM.Extensions.Rendering.Sink behaviour (ASM v0.9.2)

Copy Markdown View Source

Behaviour for sink destinations that receive rendered iodata and events.

Summary

Types

opts()

@type opts() :: keyword()

state()

@type state() :: term()

Callbacks

close(state)

@callback close(state()) :: :ok | {:error, ASM.Error.t() | term()}

flush(state)

@callback flush(state()) ::
  {:ok, state()}
  | {:error, ASM.Error.t() | term()}
  | {:error, ASM.Error.t() | term(), state()}

init(opts)

@callback init(opts()) :: {:ok, state()} | {:error, ASM.Error.t() | term()}

write(iodata, state)

@callback write(iodata(), state()) ::
  {:ok, state()}
  | {:error, ASM.Error.t() | term()}
  | {:error, ASM.Error.t() | term(), state()}

write_event(t, iodata, state)

@callback write_event(ASM.Event.t(), iodata(), state()) ::
  {:ok, state()}
  | {:error, ASM.Error.t() | term()}
  | {:error, ASM.Error.t() | term(), state()}