loom & weft
Made for Swift.

Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.

LOOM Unreleased (PR #2) / RENDERING, VIEWPORTS, AND COMPOSITION

TestBackend

A headless physical terminal surface with scrollback and injectable partial-output failures.

Each resize, clear, cursor move, row paint and line feed is one primitive step. The failure counter restarts for each update; attempted updates are retained in history. This models semantic presentation and scrolling, not arbitrary ANSI terminal input.

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.

Members on this page

Feature guides and release status

TestBackend

Structure
struct TestBackend

Conforms to: RenderBackend, Swift.Sendable, Swift.SendableMetatype.

A headless physical terminal surface with scrollback and injectable partial-output failures.

Each resize, clear, cursor move, row paint and line feed is one primitive step. The failure counter restarts for each update; attempted updates are retained in history. This models semantic presentation and scrolling, not arbitrary ANSI terminal input.

Source · TestBackend.swift:25

screen

Instance Property
var screen: Buffer { get }

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TestBackend.swift:26

cursor

Instance Property
var cursor: Point? { get }

The cursor position; see the type’s coordinate convention and lifecycle notes.

Source · TestBackend.swift:27

scrollback

Instance Property
var scrollback: [Buffer] { get }

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TestBackend.swift:28

operations

Instance Property
var operations: [RenderUpdate] { get }

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TestBackend.swift:29

failure

Instance Property
var failure: TestBackendFailure?

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TestBackend.swift:30

completedSteps

Instance Property
var completedSteps: Int { get }

A public field of this type. Its value type and mutability are shown in the declaration.

Source · TestBackend.swift:31

init(width:height:failure:)

Initializer
init(width: Int = 80, height: Int = 24, failure: TestBackendFailure? = nil)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (3)
width
Available columns in terminal cells.
height
Available rows in terminal cells.
failure
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · TestBackend.swift:34

reset()

Instance Method
mutating func reset()

Resets encoder state.

This semantic backend has no encoder and retains its diagnostic history.

Source · TestBackend.swift:42

clearHistory()

Instance Method
mutating func clearHistory()

Clears diagnostic history while retaining the physical terminal contents and failure plan.

Source · TestBackend.swift:45

render(_:)

Instance Method Throws
mutating func render(_ update: RenderUpdate) throws -> RenderStats

Applies an update or throws at the configured primitive boundary.

Parameters (1)
update
Argument type and any default are shown in the declaration; see the behavior notes above.

Returns RenderStats.

Source · TestBackend.swift:53