result
SourceValidates one raw size and returns an explicit result.
Data Structures
Branded two-dimensional sizes with explicit validation.
Sizes model non-negative width/height pairs and are commonly used for colliders, viewports, and AABB dimensions.
Reach for this module when authored or host-provided dimensions should be validated once and then carried through gameplay code, runtime bootstrap, or geometry helpers without repeating non-negative checks everywhere.
// Validate raw viewport dimensions before storing or reusing them.
const viewport = Size2.result({ width: 800, height: 600 })
if (!viewport.ok) return
// Read the branded size later without rechecking width/height validity.
const width = Size2.width(viewport.value)
Validates one raw size and returns an explicit result.
decodeValidates untrusted input of any shape, for example a value read from a save file. Descriptors built from this module use it when restoring snapshots.
optionValidates one raw size and returns null on failure.
isChecks whether one raw size already satisfies the size invariants.
Non-throwing constructor boundaries that validate raw width and height input.
Validates one raw size and returns an explicit result.
Validates untrusted input of any shape, for example a value read from a save file. Descriptors built from this module use it when restoring snapshots.
Validates one raw size and returns null on failure.
Checks whether one raw size already satisfies the size invariants.
Pure readers and raw views over already-validated size values.