Skip to main content

cmp_element_natural

Function cmp_element_natural 

Source
pub fn cmp_element_natural(
    view: &V2TypedArrayView,
    bits_a: u64,
    bits_b: u64,
) -> Option<Ordering>
Expand description

Compare two elements of the SAME view by natural ordering.

Returns Some(Ordering) on success; None if the element kind has no canonical natural ordering at v0.3 (TypedObject SURFACE per supervisor D3 + ADR-006 §2.7.14 — Bool-default refused). Callers surface a structured RuntimeError when None is returned.

bits_a and bits_b are read via read_element(view, i) and refer to the same view.elem_type (the SAME-view discipline). For heap-element reads (StringV2 / DecimalV2), the returned (bits, kind) carries the raw *const StringObj/DecimalObj pointer — the comparison here dereferences but does not retain or release the pointer (the caller’s share remains live for the comparator’s borrow).