Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

PriorityComparison

Stores a safe function comparator as a concrete priority policy.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.collections

import std.collections;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

PriorityComparison

pub final class PriorityComparison<T>

Stores a safe function comparator as a concrete priority policy.

The policy allocates nothing and never erases unsafe authorization or reference access. Positive results rank the left element higher. The function must define a consistent strict weak ordering and must not invalidate queue storage. T: Exact element type borrowed readonly during comparison.

PriorityComparison.init

pub init(Compare: fn(readonly T&, readonly T&) -> i32)

Stores one safely callable function without boxing. Compare: Safe comparator preserving both readonly element borrows.

PriorityComparison.Invoke

pub readonly fn Invoke(Left: readonly T&, Right: readonly T&) -> i32

Compares two live items through the stored function. Left: First readonly borrowed item. Right: Second readonly borrowed item. Return: Positive when Left outranks Right, negative when Right outranks Left, zero for a tie.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library