Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / TERMINAL ALIASES FROM WEFT
Rect
A half-open rectangle: x..<maxX and y..<maxY. The initializer clamps dimensions to zero or greater; its mutable fields still require sensible values and representable coordinate arithmetic. inset uses equal cell padding on all four sides.
loom.Rect is an alias for weft.Rect. 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
let area = Rect(x: 2, y: 1, width: 40, height: 8)
_ = area.inset(1)
_ = area.contains(Point(x: 3, y: 2))Members on this page
Feature guides and release status
Rect
typealias Rect = weft.weft.RectA half-open rectangle: x..<maxX and y..<maxY. The initializer clamps dimensions to zero or greater; its mutable fields still require sensible values and representable coordinate arithmetic. inset uses equal cell padding on all four sides.
Source · TerminalExports.swift:5Underlying weft API
Rect
struct RectConforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.
A rectangular region measured in terminal cells.
Source · Rect.swift:2x
var x: IntZero-based column in terminal cells.
Source · Rect.swift:3y
var y: IntZero-based row in terminal cells.
Source · Rect.swift:4width
var width: IntWidth in terminal cells.
Source · Rect.swift:5height
var height: IntHeight in terminal cells.
Source · Rect.swift:6init(x:y:width:height:)
init(x: Int = 0, y: Int = 0, width: Int, height: Int)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (4)
x- Argument type and any default are shown in the declaration; see the behavior notes above.
y- Argument type and any default are shown in the declaration; see the behavior notes above.
width- Available columns in terminal cells.
height- Available rows in terminal cells.
maxX
var maxX: Int { get }The column immediately after the rectangle's right edge.
Source · Rect.swift:16maxY
var maxY: Int { get }The row immediately after the rectangle's bottom edge.
Source · Rect.swift:21contains(_:)
func contains(_ point: Point) -> BoolTests the half-open bounds: left/top edges are included, right/bottom edges excluded.
Parameters (1)
point- Zero-based terminal-cell position.
Returns Bool.
inset(_:)
func inset(_ amount: Int = 1) -> RectInsets all four edges by the same number of cells.
Parameters (1)
amount- Amount to blend or inset, as described by this method.
Returns Rect.