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

CallableFind

Consumes a cursor with a concrete exact-item safe predicate.

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.iteration

import std.iteration;

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

Find

pub fn Find<T, I, C>(mut Cursor: I, mut Predicate: C) -> T?
    where T: Copyable where I: TypedIterator<T>
    where C: UnaryCallable<T, bool>, Movable

Consumes a cursor with a concrete exact-item safe predicate.

Examines items in order, retaining each optional during invocation. Stops on the first match or exhaustion; empty input returns none. Owning discarded items use ordinary destruction; returned carriers preserve exact ownership/access. The terminal owns the callback and adds no allocation or synchronization. Callback costs and borrowed backing validity remain its contract; no capture backing is retained implicitly. T: Exact Copyable input item type. I: Structural source cursor, inferred from Cursor. C: Concrete Movable safe predicate, inferred from Predicate. Cursor: Owned traversal state; explicitly move non-Copy named cursors. Predicate: Owned environment; borrowed captures must survive traversal. Return: First matching carrier or none; unexamined items remain unpulled. Warning: Infinite traversal without a decisive predicate result never terminates.

Find

pub fn Find<T, I, C>(mut Cursor: I, mut Predicate: C) -> T?
    where T: Movable where I: TypedIterator<T>
    where C: BorrowingUnaryCallable<T, bool>, Movable

Consumes a cursor with a concrete readonly-borrowing safe predicate.

Examines items in order, retaining each optional during invocation. Stops on the first match or exhaustion; empty input returns none. Owning discarded items use ordinary destruction; returned carriers preserve exact ownership/access. The terminal owns the callback and adds no allocation or synchronization. Callback costs and borrowed backing validity remain its contract; no capture backing is retained implicitly. T: Exact Movable input item type. I: Structural source cursor, inferred from Cursor. C: Concrete Movable safe predicate, inferred from Predicate. Cursor: Owned traversal state; explicitly move non-Copy named cursors. Predicate: Owned environment; borrowed captures must survive traversal. Return: First matching carrier or none; unexamined items remain unpulled. Warning: Infinite traversal without a decisive predicate result never terminates.

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