PromptRunner.Rendering.Sink behaviour (PromptRunnerSDK v0.6.1)

Copy Markdown View Source

Behaviour for output destinations that receive rendered prompt-runner text and raw events.

Summary

Types

opts()

@type opts() :: keyword()

state()

@type state() :: term()

Callbacks

close(state)

@callback close(state()) :: :ok

flush(state)

@callback flush(state()) :: {:ok, state()}

init(opts)

@callback init(opts()) :: {:ok, state()} | {:error, term()}

write(iodata, state)

@callback write(iodata(), state()) :: {:ok, state()} | {:error, term(), state()}

write_event(event, iodata, state)

@callback write_event(event :: map(), iodata(), state()) ::
  {:ok, state()} | {:error, term(), state()}