Skip to content

std.slice

fn-pointer predicate helpers over []T (find, count_where, any, all, …)

pub find :: fn($T: type, s: []T, pred: fn(T) -> bool) -> ?usize

index of the first match, or null

pub count_where :: fn($T: type, s: []T, pred: fn(T) -> bool) -> usize

number of matches

pub any :: fn($T: type, s: []T, pred: fn(T) -> bool) -> bool
pub all :: fn($T: type, s: []T, pred: fn(T) -> bool) -> bool
pub each :: fn($T: type, s: []T, f: fn(T))
pub map_into :: fn($T: type, $U: type, dst: []U, src: []T, f: fn(T) -> U) -> usize

dst[i] = f(src[i]) over the shorter length; returns that length

pub rfind :: fn($T: type, s: []T, pred: fn(T) -> bool) -> ?usize

index of the last match, or null