The one process that writes a session's terminal, for Drafter.Compositor.
{:ok, writer} = Drafter.Render.Writer.start_link(:tty)
Drafter.Render.Writer.write(writer, frame_bytes)Every write is one call to the sink, in the order the calls were made, so no sequence
is ever cut by another, and no call blocks the caller or is dropped. behind?/1
tells whether anything handed over is still unwritten, for a caller that would rather
merge its next frames into one than queue them.
The sink is a function of iodata, or {:tty, fallback} to write /dev/tty — which the
writer opens itself, since a raw file is usable only by the process that opened it —
using the fallback function when /dev/tty cannot be opened.
Summary
Functions
Whether anything handed over by write/2 is still waiting to be written.
Returns a specification to start this module under a supervisor.
Return once everything handed over so far has been written.
Start a writer whose sink is a function of iodata, or {:tty, fallback}.
Write bytes after everything already handed over. Asynchronous, never dropped.
Functions
@spec behind?(GenServer.server()) :: boolean()
Whether anything handed over by write/2 is still waiting to be written.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec flush(GenServer.server()) :: :ok
Return once everything handed over so far has been written.
@spec start_link((iodata() -> term()) | {:tty, (iodata() -> term())}) :: GenServer.on_start()
Start a writer whose sink is a function of iodata, or {:tty, fallback}.
@spec write(GenServer.server(), iodata()) :: :ok
Write bytes after everything already handed over. Asynchronous, never dropped.