std::vecVec utility functions.
Pure Hew implementations for common vector operations. These replace the equivalent Rust FFI functions for simple linear scans.
contains_i32Check if a Vec<i32> contains val. Returns true if found.
contains_i64Check if a Vec<i64> contains val.
contains_f64Check if a Vec<f64> contains val. Uses exact equality.
let v: Vec<f64> = Vec::new();
v.push(3.14);
println(vec.contains_f64(v, 3.14)); // true
println(vec.contains_f64(v, 0.0)); // false
contains_strCheck if a Vec<string> contains val. Uses string equality.
let v: Vec<string> = Vec::new();
v.push("hello");
println(vec.contains_str(v, "hello")); // true
println(vec.contains_str(v, "world")); // false
index_of_i32Return the index of val in a Vec<i32>, or -1 if not found.
index_of_i64Return the index of val in a Vec<i64>, or -1 if not found.
index_of_f64Return the index of the first occurrence of val in v, or -1 if not found.
Uses exact equality; NaN will never match.
let v: Vec<f64> = Vec::new();
v.push(1.5);
v.push(2.5);
println(vec.index_of_f64(v, 2.5)); // 1
println(vec.index_of_f64(v, 9.9)); // -1
index_of_strReturn the index of the first occurrence of val in v, or -1 if not found.
let v: Vec<string> = Vec::new();
v.push("a");
v.push("b");
println(vec.index_of_str(v, "b")); // 1
println(vec.index_of_str(v, "z")); // -1
first_i64Return Some of the first element of a Vec<i64>, or None if empty.
first_f64Return Some of the first element of v, or None if v is empty.
first_strReturn Some of the first element of v, or None if v is empty.
last_i64Return Some of the last element of a Vec<i64>, or None if empty.
last_f64Return Some of the last element of v, or None if v is empty.
last_strReturn Some of the last element of v, or None if v is empty.
min_i32Return Some of the smallest element in a Vec<i32>, or None if empty.
min_i64Return Some of the smallest element in a Vec<i64>, or None if empty.
min_f64Return Some of the smallest element in v, or None if v is empty.
NaN propagates: if any element is NaN the result is unspecified.
max_i32Return Some of the largest element in a Vec<i32>, or None if empty.
max_i64Return Some of the largest element in a Vec<i64>, or None if empty.
max_f64Return Some of the largest element in v, or None if v is empty.
NaN propagates: if any element is NaN the result is unspecified.