Axle v0.14.1
Package

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 richer
Optional::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

TypeMethod and description
constructor(first : A, second : B) Pair holding first and second.

Method detail

#constructor

constructor(first : A, second : B)

Pair holding first and second.

Parameters
first value stored in the first field
second value stored in the second field

C 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

TypeMethod 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

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.

Parameters
present true if v is a real value, false if absent
v the held value; ignored placeholder when present is false

Methods

Method detail

#isPresent

isPresent(self) : bool

#isEmpty

isEmpty(self) : bool

#orElse

orElse(self, fallback : T) : T