std/core/util
std/core/util — small utilities (Optional / Pair).Optional<T> and Pair<A, B> are implementable in pure Axle
without any FFI: they're tiny generic classes whose methods are
straight assignments / branches over their fields. The richerOptional::map(fn) / filter(fn) variants require lambda
support, so this module exposes the no-lambda subset.
C class Pair<A, B>
An immutable two-value tuple — first / second are set once at
construction and read back as plain fields.
Constructors
| Type | Method and description |
|---|---|
| constructor(first : A, second : B) Pair holding first and second. |
Method detail
#constructor
Pair holding first and second.
first value stored in the first fieldsecond value stored in the second fieldC class Optional<T>
Minimal surface: the heavy map / filter / ifPresent
methods require lambdas (deferred). orElse(fallback) is the
only safe accessor — a typed get() throws NoSuchElementException
depends on the throwing-i32-return gap (api/stdlib.md #9).
Constructors
| Type | Method and description |
|---|---|
| constructor(present : bool, v : T) Low-level constructor: present flags whether v is a real value.When present is false, v is an ignored placeholder. |
Method detail
#constructor
Low-level constructor: present flags whether v is a real value.
When present is false, v is an ignored placeholder.
present true if v is a real value, false if absentv the held value; ignored placeholder when present is falseMethods
| Type | Method and description |
|---|---|
| isPresent(self) : bool |
| isEmpty(self) : bool |
| orElse(self, fallback : T) : T |