Page
Library
Module
Module type
Parameter
Class
Class type
Source
VecSourceA value of type ('a, 'p) Vec.t is a vector of values of type 'a, with mutability permissions 'p.
The permissions can be [`R | `W] for read-write vectors, [`R] for read-only vectors, or [`W] for write-only vectors.
Constructs a vector with the specified capacity (defaults to 0).
Constructs a vector containing all numbers in the specified range. Both ascending and descending ranges are supported.
Returns a singleton vector containing the specified item. (Applicative functor pure operation)
Reinterprets the vector as a read-only vector.
Reinterprets the vector as a write-only vector.
Gets the value in the vector at the specified index. Returns None if the index is out of range.
Sets the value in the vector at the specified index to the specified value.
Sets the value in the vector at the specified index to the specified value. Returns false if the index is out of range.
Returns the first element of the vector that satisfies the predicate.
Returns the first element of the vector that satisfies the predicate, or None.
Constructs a vector from a copy of the specified array.
Constructs an array containing the values of specified vector.
Constructs a vector from the specified array, without copying.
Returns the vector's underlying buffer. Note: The array may contain uninitialized elements.
Returns a string representation of the vector, using the specified function to format each value.
Ensures the vector's capacity is at least as large as the specified value, allocating if necessary.
Shrinks the vector's internal buffer to only be as large as the vector's length.
Pops off the item from the end of the vector. Returns None if the vector is empty.
Inserts an item into the vector at the specified index.
Inserts an item into the vector at the specified index. Returns false if the index is out of range.
Removes and returns the item at the specified index.
Removes and returns the item at the specified index. Returns None if the index is out of range.
Maps the specified function over the vector, returning a new vector. (Functor map operation)
Like map, but the function also takes the item's index as a parameter.
Like map, but the transformation is done in-place.
Like map, but flattens the result. (Monad bind operation)
Returns a new vector that contains all the items in the specified vector, but in reverse order.
Returns a new vector containing only the items from the first vector that satisfy the specified predicate.
Like filter, but the predicate also takes the item's index as a parameter.
Performs a filter in-place, based on the specified predicate.
Folds the specified function and default value over the array, from left to right.
Folds the specified function and default value over the array, from right to left.
Concatenates the two vectors into a new vector.
Appends the second vector to the first vector in-place.
Cartesian product of 2 vectors. (Equivalent to liftA2 (,))
Maps the specified function over all combinations of tuples from the 2 vectors, returning a new vector. (Applicative functor liftA2 operation
Applies every function from the first vector to every value from the second vector, returning a new vector. (Applicatve functor ap operation)
Flattens nested vectors into a single, one-dimensional vector. (Monad join operation)
Zips the two vectors together.
Zips the two vectors together, using the specified function to combine values.
Returns true if any item in the vector satisfies the specified predicate.
Returns true if all items in the vector satisfy the specified predicate.
Returns true if the specified item exists in the vector. Uses structural equality.
Returns true if the specified item exists in the vector. Uses physical equality.
Sorts the vector in-place, using the specified comparison function.
Compares two vectors for equality, using the specified equality function for elements.
Compares two vectors lexicographically.
Compares two vectors lexicographically, using the specified comparison function for elements.
Applies the specified function to each item in the vector.
Like iter, but the function also takes the item's index as a parameter.
Contains infix versions of some vector operations, as well as binding operators and extended indexing operators.