vec
12 items · generated by scribe fromstdlib/vec.fd· synced 2026-11-15
Contents
- Vec (struct)
- Vec (impl)
- vec_take (function)
- vec_skip (function)
- vec_zip (function)
- vec_enumerate (function)
- vec_flat_map (function)
- vec_chunk (function)
- vec_window (function)
- vec_dedup (function)
- vec_sort_by (function)
- vec_contains_val (function)
Vec
A growable array. The basic operations (push, pop, len, get, set, …) are core’s; this module adds map, filter, fold and the other helpers.
Example: var v: Vec
pub struct Vec<T> {Fields:
| Name | Type |
|---|---|
data | i64 |
len | i64, cap: i64 |
Defined at line 36
Vec
impl Vec {Defined at line 41
vec_take
The first n elements (all of them if there are fewer) as a new Vec.
Example: var v: Vec
pub fn vec_take(self: Vec<i64>, n: i64) -> Vec<i64> {Parameters:
self:Vec<i64>n:i64
Returns: Vec<i64>
Defined at line 213
vec_skip
Everything after the first n elements, as a new Vec.
Example: var v: Vec
pub fn vec_skip(self: Vec<i64>, n: i64) -> Vec<i64> {Parameters:
self:Vec<i64>n:i64
Returns: Vec<i64>
Defined at line 236
vec_zip
The elements of both Vecs interleaved pairwise (a0, b0, a1, b1, …), up to the length of the shorter one.
Example: var a: Vec
pub fn vec_zip(self: Vec<i64>, other: Vec<i64>) -> Vec<i64> {Parameters:
self:Vec<i64>other:Vec<i64>
Returns: Vec<i64>
Defined at line 263
vec_enumerate
Index and element pairs flattened into one Vec (0, v0, 1, v1, …).
Example: var v: Vec
pub fn vec_enumerate(self: Vec<i64>) -> Vec<i64> {Parameters:
self:Vec<i64>
Returns: Vec<i64>
Defined at line 289
vec_flat_map
Concatenation of the Vecs that f returns for each element (f returns a Vec handle as an i64).
pub fn vec_flat_map(self: Vec<i64>, f: fn(i64) -> i64) -> Vec<i64> {Parameters:
self:Vec<i64>f:fn(i64) -> i64
Returns: Vec<i64>
Defined at line 303
vec_chunk
The start index of each chunk of size elements.
Example: var v: Vec
pub fn vec_chunk(self: Vec<i64>, size: i64) -> Vec<i64> {Parameters:
self:Vec<i64>size:i64
Returns: Vec<i64>
Defined at line 328
vec_window
The start index of every full window of size consecutive elements.
Example: var v: Vec
pub fn vec_window(self: Vec<i64>, size: i64) -> Vec<i64> {Parameters:
self:Vec<i64>size:i64
Returns: Vec<i64>
Defined at line 347
vec_dedup
Remove consecutive duplicates in place (sort first to remove all).
Example: var v: Vec
pub fn vec_dedup(self: & mut Vec<i64>) -> void {Parameters:
self:& mut Vec<i64>
Returns: void
Defined at line 369
vec_sort_by
Sort in place with a comparison function (negative, zero or positive, like a - b). Stable insertion sort.
Example: var v: Vec
pub fn vec_sort_by(self: & mut Vec<i64>, cmp: fn(i64, i64) -> i64) -> void {Parameters:
self:& mut Vec<i64>cmp:fn(i64
Returns: void
Defined at line 395
vec_contains_val
Whether the Vec holds value.
Example: var v: Vec
pub fn vec_contains_val(self: Vec<i64>, value: i64) -> bool {Parameters:
self:Vec<i64>value:i64
Returns: bool
Defined at line 420
Generated by scribe, the Fides documentation generator