lisette-stdlib 0.1.13

Little language inspired by Rust that compiles to Go
Documentation
// Generated by Lisette bindgen
// Source: iter (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.12

/// Pull converts the “push-style” iterator sequence seq
/// into a “pull-style” iterator accessed by the two functions
/// next and stop.
/// 
/// Next returns the next value in the sequence
/// and a boolean indicating whether the value is valid.
/// When the sequence is over, next returns the zero V and false.
/// It is valid to call next after reaching the end of the sequence
/// or after calling stop. These calls will continue
/// to return the zero V and false.
/// 
/// Stop ends the iteration. It must be called when the caller is
/// no longer interested in next values and next has not yet
/// signaled that the sequence is over (with a false boolean return).
/// It is valid to call stop multiple times and when next has
/// already returned false. Typically, callers should “defer stop()”.
/// 
/// It is an error to call next or stop from multiple goroutines
/// simultaneously.
/// 
/// If the iterator panics during a call to next (or stop),
/// then next (or stop) itself panics with the same value.
pub fn Pull<V>(seq: Seq<V>) -> (Option<fn() -> Option<V>>, Option<fn() -> ()>)

/// Pull2 converts the “push-style” iterator sequence seq
/// into a “pull-style” iterator accessed by the two functions
/// next and stop.
/// 
/// Next returns the next pair in the sequence
/// and a boolean indicating whether the pair is valid.
/// When the sequence is over, next returns a pair of zero values and false.
/// It is valid to call next after reaching the end of the sequence
/// or after calling stop. These calls will continue
/// to return a pair of zero values and false.
/// 
/// Stop ends the iteration. It must be called when the caller is
/// no longer interested in next values and next has not yet
/// signaled that the sequence is over (with a false boolean return).
/// It is valid to call stop multiple times and when next has
/// already returned false. Typically, callers should “defer stop()”.
/// 
/// It is an error to call next or stop from multiple goroutines
/// simultaneously.
/// 
/// If the iterator panics during a call to next (or stop),
/// then next (or stop) itself panics with the same value.
pub fn Pull2<K, V>(seq: Seq2<K, V>) -> (Option<fn() -> Option<(K, V)>>, Option<fn() -> ()>)

/// Seq is an iterator over sequences of individual values.
/// When called as seq(yield), seq calls yield(v) for each value v in the sequence,
/// stopping early if yield returns false.
/// See the [iter] package documentation for more details.
pub type Seq<V> = fn(fn(V) -> bool) -> ()

/// Seq2 is an iterator over sequences of pairs of values, most commonly key-value pairs.
/// When called as seq(yield), seq calls yield(k, v) for each pair (k, v) in the sequence,
/// stopping early if yield returns false.
/// See the [iter] package documentation for more details.
pub type Seq2<K, V> = fn(fn(K, V) -> bool) -> ()