Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / TERMINAL ALIASES FROM WEFT
Backend
Implement a mutating throwing write(Data) method that writes every byte in order or throws. Terminal is generic over this protocol, so a custom backend can capture output for tests.
loom.Backend is an alias for weft.Backend. It is available through import loom. The underlying type’s members are documented here.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
struct Capture: Backend {
var bytes = Data()
mutating func write(_ data: Data) throws { bytes.append(data) }
}
var terminal = Terminal(backend: Capture(), width: 10, height: 2)
try terminal.draw { _ in }
_ = terminal.backend.bytesMembers on this page
Feature guides and release status
Backend
typealias Backend = weft.weft.BackendImplement a mutating throwing write(Data) method that writes every byte in order or throws. Terminal is generic over this protocol, so a custom backend can capture output for tests.
Source · TerminalExports.swift:6Underlying weft API
Backend
protocol BackendAn output destination for terminal bytes.
Source · Backend.swift:4write(_:)
mutating func write(_ data: Data) throwsWrites every byte in order or throws an error.
Parameters (1)
data- Bytes to write in order.
execute(_:)
mutating func execute(_ commands: [TerminalCommand]) throwsBatch commands in one write, preserving their order.
Parameters (1)
commands- Argument type and any default are shown in the declaration; see the behavior notes above.