Vectors
UnboxedVecRepr - The internal 'unboxed' representation of a vectorConstVectorCopyableVectorImmutableCopyableVectorImmutableEqVectorImmutableVectorMutableCopyableVectorMutableEqVectorMutableVectorof ConstVector for &[const T] - Extension methods for vectorsof CopyableVector<T> for &[const T] - Extension methods for vectorsof ImmutableVector<T> for &[T] - Extension methods for vectorsof ImmutableEqVector<T> for &[T]of ImmutableCopyableVector<T> for &[T] - Extension methods for vectorsof MutableVector<T> for ~[T]of MutableCopyableVector<T> for ~[T]of MutableEqVector<T> for ~[T]of iter::BaseIter<A> for &[A]of iter::BaseIter<A> for ~[A]of iter::BaseIter<A> for @[A]of iter::ExtendedIter<A> for &[A]of iter::ExtendedIter<A> for ~[A]of iter::ExtendedIter<A> for @[A]of iter::EqIter<A> for &[A]of iter::EqIter<A> for ~[A]of iter::EqIter<A> for @[A]of iter::CopyableIter<A> for &[A]of iter::CopyableIter<A> for ~[A]of iter::CopyableIter<A> for @[A]of iter::CopyableOrderedIter<A> for &[A]of iter::CopyableOrderedIter<A> for ~[A]of iter::CopyableOrderedIter<A> for @[A]of iter::CopyableNonstrictIter<A> for &[A]of iter::CopyableNonstrictIter<A> for ~[A]of iter::CopyableNonstrictIter<A> for @[A]all - Return true if a predicate matches all elementsall2 - Return true if a predicate matches all elements in both vectors.alli - Return true if a predicate matches all elementsany - Return true if a predicate matches any elementsany2 - Return true if a predicate matches any elements in both vectors.appendappend_mutappend_oneas_const_buf - Similar to as_imm_buf but passing a *const Tas_imm_buf - Work with the buffer of a vector.as_mut_buf - Similar to as_imm_buf but passing a *mut Tbuild - Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vector.build_sized - Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vectorbuild_sized_opt - Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vectorcapacity - Returns the number of elements the vector can hold without reallocatingconcat - Concatenate a vector of vectors.connect - Concatenate a vector of vectors, placing a given separator between eachconst_view - Return a slice that points into another slice.consumeconsume_mutcontains - Return true if a vector contains an element with the given valuecount - Returns the number of elements that are equal to a given valuededup - Remove consecutive repeated elements from a vector; if the vector is sorted, this removes all duplicates.each - Iterates over a vector, with option to breakeach2 - Iterates over two vectors simultaneouslyeach_const - Like each(), but for the case where you have a vector that may or may not have mutable contents.each_muteach_permutation - Iterate over all permutations of vector v.eachi - Iterates over a vector's elements and indiceseqfilter - Construct a new vector from the elements of a vector for which some predicate holds.filter_map - Apply a function to each element of a vector and return the resultsfind - Search for the first element that matches a given predicatefind_between - Search for the first element that matches a given predicate within a rangeflat_map - Apply a function to each element of a vector and return a concatenation of each result vectorfoldl - Reduce a vector from left to rightfoldr - Reduce a vector from right to leftfrom_buf - Constructs a vector from an unsafe pointer to a bufferfrom_elem - Creates and initializes an immutable vector.from_fn - Creates and initializes an immutable vector.from_mut - Produces an immutable vector from a mut vector.from_slice - Creates a new unique vector with the same contents as the slicegegrow - Expands a vector in place, initializing the new elements to a given valuegrow_fn - Expands a vector in place, initializing the new elements to the result of a functiongrow_set - Sets the value of a vector element at a given index, growing the vector as neededgthead - Returns the first element of a vectorinit - Returns a vector containing all but the last element of a sliceinsert - Insert an element at position i within v, shifting all elements after position i one position to the right.is_empty - Returns true if a vector contains no elementsis_not_empty - Returns true if a vector contains some elementslast - Returns the last element of the slice v, failing if the slice is empty.last_opt - Returns Some(x) where x is the last element of the slice v, or none if the vector is empty.lelen - Returns the length of a vectorltmap - Apply a function to each element of a vector and return the resultsmap2 - Apply a function to each pair of elements and return the resultsmap_consumemapi - Apply a function to each element of a vector and return the resultsmut_view - Return a slice that points into another slice.pop - Remove the last element from a vector and return itposition - Find the first index matching some predicateposition_between - Find the first index matching some predicate within a rangeposition_elem - Find the first index containing a matching valuepush - Append an element to a vectorpush_allpush_all_movepush_fastpush_slowremove - Remove and return the element at position i within v, shifting all elements after position i one position to the left.reserve - Reserves capacity for exactly n elements in the given vector.reserve_at_least - Reserves capacity for at least n elements in the given vector.retain - Like filter(), but in placerev_each - Iterates over a vector's elements in reverserev_eachi - Iterates over a vector's elements and indices in reversereverse - Reverse the order of elements in a vector, in placereversed - Returns a vector with the order of elements reversedrfind - Search for the last element that matches a given predicaterfind_between - Search for the last element that matches a given predicate within a rangerposition - Find the last index matching some predicaterposition_between - Find the last index matching some predicate within a rangerposition_elem - Find the last index containing a matching valuersplit - Reverse split the vector v by applying each element against the predicate f.rsplitn - Reverse split the vector v by applying each element against the predicate f up to `n times.same_length - Returns true if two vectors have the same lengthshift - Removes the first element from a vector and return itslice - Returns a copy of the elements from [start..end) from v.split - Split the vector v by applying each element against the predicate f.splitn - Split the vector v by applying each element against the predicate f up to n times.swap - Swaps two elements in a vectorswap_remove - Remove an element from anywhere in the vector and return it, replacing it with the last elementtail - Returns a vector containing all but the first element of a slicetailn - Returns a vector containing all but the first n \ elements of a sliceto_mut - Produces a mut vector from an immutable vector.truncate - Shorten a vector, dropping excess elements.unshift - Prepend an element to the vectorunzip - Convert a vector of pairs into a pair of vectors.unzip_slice - Convert a vector of pairs into a pair of vectors, by referenceview - Return a slice that points into another slice.windowedwith_capacityzip - Convert two vectors to a vector of pairs.zip_slice - Convert two vectors to a vector of pairs, by referencevec::bytes - Operations on [u8]vec::raw - Unsafe operationsvec::rustivec::rustrtUnboxedVecReprpub struct UnboxedVecRepr {
mut fill: uint,
mut alloc: uint,
data: u8,
}
The internal 'unboxed' representation of a vector
ConstVectoris_emptyfn is_empty() -> bool
is_not_emptyfn is_not_empty() -> bool
lenfn len() -> uint
CopyableVectorheadfn head() -> T
initfn init() -> ~[T]
lastfn last() -> T
slicefn slice(start: uint, end: uint) -> ~[T]
tailfn tail() -> ~[T]
ImmutableCopyableVectorfilterfn filter(f: &fn(t: &T) -> bool) -> ~[T]
rfindfn rfind(f: &fn(t: &T) -> bool) -> Option<T>
ImmutableEqVectorpositionfn position(f: &fn(t: &T) -> bool) -> Option<uint>
position_elemfn position_elem(t: &T) -> Option<uint>
rpositionfn rposition(f: &fn(t: &T) -> bool) -> Option<uint>
rposition_elemfn rposition_elem(t: &T) -> Option<uint>
ImmutableVectorviewfn view(start: uint, end: uint) -> &self /[T]
foldrfn foldr<U: Copy>(z: U, p: &fn(t: &T, u: U) -> U) -> U
mapfn map<U>(f: &fn(t: &T) -> U) -> ~[U]
mapifn mapi<U>(f: &fn(uint, t: &T) -> U) -> ~[U]
map_rfn map_r<U>(f: &fn(x: &T) -> U) -> ~[U]
allifn alli(f: &fn(uint, t: &T) -> bool) -> bool
flat_mapfn flat_map<U>(f: &fn(t: &T) -> ~[U]) -> ~[U]
filter_mapfn filter_map<U: Copy>(f: &fn(t: &T) -> Option<U>) -> ~[U]
MutableCopyableVectorpush_allfn push_all(rhs: &[const T])
growfn grow(n: uint, initval: &T)
grow_fnfn grow_fn(n: uint, op: iter::InitOp<T>)
grow_setfn grow_set(index: uint, initval: &T, val: T)
MutableEqVectordedupfn dedup()
MutableVectorpushfn push(t: T)
push_all_movefn push_all_move(rhs: ~[T])
popfn pop() -> T
shiftfn shift() -> T
unshiftfn unshift(x: T)
insertfn insert(i: uint, x: T)
removefn remove(i: uint) -> T
swap_removefn swap_remove(index: uint) -> T
truncatefn truncate(newlen: uint)
retainfn retain(f: &pure fn(t: &T) -> bool)
ConstVector for &[const T]Extension methods for vectors
is_emptyfn is_empty() -> bool
Returns true if a vector contains no elements
is_not_emptyfn is_not_empty() -> bool
Returns true if a vector contains some elements
lenfn len() -> uint
Returns the length of a vector
CopyableVector<T> for &[const T]Extension methods for vectors
headfn head() -> T
Returns the first element of a vector
initfn init() -> ~[T]
Returns all but the last elemnt of a vector
lastfn last() -> T
Returns the last element of a v, failing if the vector is empty.
slicefn slice(start: uint, end: uint) -> ~[T]
Returns a copy of the elements from [start..end) from v.
tailfn tail() -> ~[T]
Returns all but the first element of a vector
ImmutableVector<T> for &[T]Extension methods for vectors
viewfn view(start: uint, end: uint) -> &self /[T]
Return a slice that points into another slice.
foldrfn foldr<U: Copy>(z: U, p: &fn(t: &T, u: U) -> U) -> U
Reduce a vector from right to left
mapfn map<U>(f: &fn(t: &T) -> U) -> ~[U]
Apply a function to each element of a vector and return the results
mapifn mapi<U>(f: &fn(uint, t: &T) -> U) -> ~[U]
Apply a function to the index and value of each element in the vector and return the results
map_rfn map_r<U>(f: &fn(x: &T) -> U) -> ~[U]
allifn alli(f: &fn(uint, t: &T) -> bool) -> bool
Returns true if the function returns true for all elements.
If the vector is empty, true is returned.
flat_mapfn flat_map<U>(f: &fn(t: &T) -> ~[U]) -> ~[U]
Apply a function to each element of a vector and return a concatenation of each result vector
filter_mapfn filter_map<U: Copy>(f: &fn(t: &T) -> Option<U>) -> ~[U]
Apply a function to each element of a vector and return the results
If function f returns none then that element is excluded from the resulting vector.
ImmutableEqVector<T> for &[T]positionfn position(f: &fn(t: &T) -> bool) -> Option<uint>
Find the first index matching some predicate
Apply function f to each element of v. When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
position_elemfn position_elem(x: &T) -> Option<uint>
Find the first index containing a matching value
rpositionfn rposition(f: &fn(t: &T) -> bool) -> Option<uint>
Find the last index matching some predicate
Apply function f to each element of v in reverse order. When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
rposition_elemfn rposition_elem(t: &T) -> Option<uint>
Find the last index containing a matching value
ImmutableCopyableVector<T> for &[T]Extension methods for vectors
filterfn filter(f: &fn(t: &T) -> bool) -> ~[T]
Construct a new vector from the elements of a vector for which some predicate holds.
Apply function f to each element of v and return a vector containing only those elements for which f returned true.
rfindfn rfind(f: &fn(t: &T) -> bool) -> Option<T>
Search for the last element that matches a given predicate
Apply function f to each element of v in reverse order. When function f returns true then an option containing the element is returned. If f matches no elements then none is returned.
MutableVector<T> for ~[T]pushfn push(t: T)
push_all_movefn push_all_move(rhs: ~[T])
popfn pop() -> T
shiftfn shift() -> T
unshiftfn unshift(x: T)
insertfn insert(i: uint, x: T)
removefn remove(i: uint) -> T
swap_removefn swap_remove(index: uint) -> T
truncatefn truncate(newlen: uint)
retainfn retain(f: &pure fn(t: &T) -> bool)
MutableCopyableVector<T> for ~[T]push_allfn push_all(rhs: &[const T])
growfn grow(n: uint, initval: &T)
grow_fnfn grow_fn(n: uint, op: iter::InitOp<T>)
grow_setfn grow_set(index: uint, initval: &T, val: T)
MutableEqVector<T> for ~[T]dedupfn dedup()
iter::BaseIter<A> for &[A]eachfn each(blk: &fn(v: &A) -> bool)
size_hintfn size_hint() -> Option<uint>
iter::BaseIter<A> for ~[A]eachfn each(blk: &fn(v: &A) -> bool)
size_hintfn size_hint() -> Option<uint>
iter::BaseIter<A> for @[A]eachfn each(blk: &fn(v: &A) -> bool)
size_hintfn size_hint() -> Option<uint>
iter::ExtendedIter<A> for &[A]eachifn eachi(blk: &fn(uint, v: &A) -> bool)
allfn all(blk: &fn(&A) -> bool) -> bool
anyfn any(blk: &fn(&A) -> bool) -> bool
foldlfn foldl<B>(b0: B, blk: &fn(&B, &A) -> B) -> B
positionfn position(f: &fn(&A) -> bool) -> Option<uint>
map_to_vecfn map_to_vec<B>(op: &fn(&A) -> B) -> ~[B]
flat_map_to_vecfn flat_map_to_vec<B, IB: BaseIter<B>>(op: &fn(&A) -> IB) -> ~[B]
iter::ExtendedIter<A> for ~[A]eachifn eachi(blk: &fn(uint, v: &A) -> bool)
allfn all(blk: &fn(&A) -> bool) -> bool
anyfn any(blk: &fn(&A) -> bool) -> bool
foldlfn foldl<B>(b0: B, blk: &fn(&B, &A) -> B) -> B
positionfn position(f: &fn(&A) -> bool) -> Option<uint>
map_to_vecfn map_to_vec<B>(op: &fn(&A) -> B) -> ~[B]
flat_map_to_vecfn flat_map_to_vec<B, IB: BaseIter<B>>(op: &fn(&A) -> IB) -> ~[B]
iter::ExtendedIter<A> for @[A]eachifn eachi(blk: &fn(uint, v: &A) -> bool)
allfn all(blk: &fn(&A) -> bool) -> bool
anyfn any(blk: &fn(&A) -> bool) -> bool
foldlfn foldl<B>(b0: B, blk: &fn(&B, &A) -> B) -> B
positionfn position(f: &fn(&A) -> bool) -> Option<uint>
map_to_vecfn map_to_vec<B>(op: &fn(&A) -> B) -> ~[B]
flat_map_to_vecfn flat_map_to_vec<B, IB: BaseIter<B>>(op: &fn(&A) -> IB) -> ~[B]
iter::EqIter<A> for &[A]containsfn contains(x: &A) -> bool
countfn count(x: &A) -> uint
iter::EqIter<A> for ~[A]containsfn contains(x: &A) -> bool
countfn count(x: &A) -> uint
iter::EqIter<A> for @[A]containsfn contains(x: &A) -> bool
countfn count(x: &A) -> uint
iter::CopyableIter<A> for &[A]filter_to_vecfn filter_to_vec(pred: &fn(&A) -> bool) -> ~[A]
to_vecfn to_vec() -> ~[A]
findfn find(f: &fn(&A) -> bool) -> Option<A>
iter::CopyableIter<A> for ~[A]filter_to_vecfn filter_to_vec(pred: &fn(&A) -> bool) -> ~[A]
to_vecfn to_vec() -> ~[A]
findfn find(f: &fn(&A) -> bool) -> Option<A>
iter::CopyableIter<A> for @[A]filter_to_vecfn filter_to_vec(pred: &fn(&A) -> bool) -> ~[A]
to_vecfn to_vec() -> ~[A]
findfn find(f: &fn(&A) -> bool) -> Option<A>
iter::CopyableOrderedIter<A> for &[A]minfn min() -> A
maxfn max() -> A
iter::CopyableOrderedIter<A> for ~[A]minfn min() -> A
maxfn max() -> A
iter::CopyableOrderedIter<A> for @[A]minfn min() -> A
maxfn max() -> A
iter::CopyableNonstrictIter<A> for &[A]each_valfn each_val(f: &fn(A) -> bool)
iter::CopyableNonstrictIter<A> for ~[A]each_valfn each_val(f: &fn(A) -> bool)
iter::CopyableNonstrictIter<A> for @[A]each_valfn each_val(f: &fn(A) -> bool)
allfn all<T>(v: &[T], f: &fn(t: &T) -> bool) -> bool
Return true if a predicate matches all elements
If the vector contains no elements then true is returned.
all2fn all2<T, U>(v0: &[T], v1: &[U], f: &fn(t: &T, u: &U) -> bool) -> bool
Return true if a predicate matches all elements in both vectors.
If the vectors are not the same size then false is returned.
allifn alli<T>(v: &[T], f: &fn(uint, t: &T) -> bool) -> bool
Return true if a predicate matches all elements
If the vector contains no elements then true is returned.
anyfn any<T>(v: &[T], f: &fn(t: &T) -> bool) -> bool
Return true if a predicate matches any elements
If the vector contains no elements then false is returned.
any2fn any2<T, U>(v0: &[T], v1: &[U], f: &fn(a: &T, b: &U) -> bool) -> bool
Return true if a predicate matches any elements in both vectors.
If the vectors contains no elements then false is returned.
appendfn append<T: Copy>(lhs: ~[T], rhs: &[const T]) -> ~[T]
append_mutfn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T]
append_onefn append_one<T>(lhs: ~[T], x: T) -> ~[T]
as_const_buffn as_const_buf<T, U>(s: &[const T], f: &fn(*const T, uint) -> U) -> U
Similar to as_imm_buf but passing a *const T
as_imm_buffn as_imm_buf<T, U>(s: &[T], f: &fn(*T, uint) -> U) -> U
Work with the buffer of a vector.
Allows for unsafe manipulation of vector contents, which is useful for foreign interop.
as_mut_buffn as_mut_buf<T, U>(s: &[mut T], f: &fn(*mut T, uint) -> U) -> U
Similar to as_imm_buf but passing a *mut T
buildfn build<A>(builder: &fn(push: &pure fn(v: A))) -> ~[A]
Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vector.
build_sizedfn build_sized<A>(size: uint, builder: &fn(push: &pure fn(v: A))) -> ~[A]
Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vector. This version takes an initial size for the vector.
build_sized_optfn build_sized_opt<A>(size: Option<uint>, builder: &fn(push: &pure fn(v: A)))
-> ~[A]
Builds a vector by calling a provided function with an argument function that pushes an element to the back of a vector. This version takes an initial size for the vector.
capacityfn capacity<T>(v: &const ~[T]) -> uint
Returns the number of elements the vector can hold without reallocating
concatfn concat<T: Copy>(v: &[~[T]]) -> ~[T]
Concatenate a vector of vectors.
Flattens a vector of vectors of T into a single vector of T.
connectfn connect<T: Copy>(v: &[~[T]], sep: &T) -> ~[T]
Concatenate a vector of vectors, placing a given separator between each
const_viewfn const_view<T>(v: &r/[const T], start: uint, end: uint) -> &r/[const T]
Return a slice that points into another slice.
consumefn consume<T>(v: ~[T], f: &fn(uint, v: T))
consume_mutfn consume_mut<T>(v: ~[mut T], f: &fn(uint, v: T))
containsfn contains<T: Eq>(v: &[T], x: &T) -> bool
Return true if a vector contains an element with the given value
countfn count<T: Eq>(v: &[T], x: &T) -> uint
Returns the number of elements that are equal to a given value
dedupfn dedup<T: Eq>(v: &mut ~[T])
Remove consecutive repeated elements from a vector; if the vector is sorted, this removes all duplicates.
eachfn each<T>(v: &r/[T], f: &fn(&r/T) -> bool)
Iterates over a vector, with option to break
Return true to continue, false to break.
each2fn each2<U, T>(v1: &[U], v2: &[T], f: &fn(u: &U, t: &T) -> bool)
Iterates over two vectors simultaneously
Both vectors must have the same length
each_constfn each_const<T>(v: &[const T], f: &fn(elem: &const T) -> bool)
Like each(), but for the case where you have a vector that may or may not have mutable contents.
each_mutfn each_mut<T>(v: &[mut T], f: &fn(elem: &mut T) -> bool)
Like each(), but for the case where you have a vector with mutable contents and you would like to mutate the contents as you iterate.
each_permutationfn each_permutation<T: Copy>(v: &[T], put: &fn(ts: &[T]) -> bool)
Iterate over all permutations of vector v.
Permutations are produced in lexicographic order with respect to the order of elements in v (so if v is sorted then the permutations are lexicographically sorted).
The total number of permutations produced is len(v)!. If v contains repeated elements, then some permutations are repeated.
eachifn eachi<T>(v: &r/[T], f: &fn(uint, v: &r/T) -> bool)
Iterates over a vector's elements and indices
Return true to continue, false to break.
eqfn eq<T: Eq>(a: &[T], b: &[T]) -> bool
filterfn filter<T: Copy>(v: &[T], f: &fn(t: &T) -> bool) -> ~[T]
Construct a new vector from the elements of a vector for which some predicate holds.
Apply function f to each element of v and return a vector containing only those elements for which f returned true.
filter_mapfn filter_map<T, U: Copy>(v: &[T], f: &fn(t: &T) -> Option<U>) -> ~[U]
Apply a function to each element of a vector and return the results
If function f returns none then that element is excluded from the resulting vector.
findfn find<T: Copy>(v: &[T], f: &fn(t: &T) -> bool) -> Option<T>
Search for the first element that matches a given predicate
Apply function f to each element of v, starting from the first. When function f returns true then an option containing the element is returned. If f matches no elements then none is returned.
find_betweenfn find_between<T: Copy>(v: &[T], start: uint, end: uint,
f: &fn(t: &T) -> bool) -> Option<T>
Search for the first element that matches a given predicate within a range
Apply function f to each element of v within the range [start, end). When function f returns true then an option containing the element is returned. If f matches no elements then none is returned.
flat_mapfn flat_map<T, U>(v: &[T], f: &fn(t: &T) -> ~[U]) -> ~[U]
Apply a function to each element of a vector and return a concatenation of each result vector
foldlfn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T
Reduce a vector from left to right
foldrfn foldr<T, U: Copy>(v: &[T], z: U, p: &fn(t: &T, u: U) -> U) -> U
Reduce a vector from right to left
from_buffn from_buf<T>(ptr: *T, elts: uint) -> ~[T]
Constructs a vector from an unsafe pointer to a buffer
Tfrom_elemfn from_elem<T: Copy>(n_elts: uint, t: T) -> ~[T]
Creates and initializes an immutable vector.
Creates an immutable vector of size n_elts and initializes the elements to the value t.
from_fnfn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> ~[T]
Creates and initializes an immutable vector.
Creates an immutable vector of size n_elts and initializes the elements to the value returned by the function op.
from_mutfn from_mut<T>(v: ~[mut T]) -> ~[T]
Produces an immutable vector from a mut vector.
from_slicefn from_slice<T: Copy>(t: &[T]) -> ~[T]
Creates a new unique vector with the same contents as the slice
gefn ge<T: Ord>(a: &[T], b: &[T]) -> bool
growfn grow<T: Copy>(v: &mut ~[T], n: uint, initval: &T)
Expands a vector in place, initializing the new elements to a given value
grow_fnfn grow_fn<T>(v: &mut ~[T], n: uint, op: iter::InitOp<T>)
Expands a vector in place, initializing the new elements to the result of a function
Function init_op is called n times with the values [0..n)
grow_setfn grow_set<T: Copy>(v: &mut ~[T], index: uint, initval: &T, val: T)
Sets the value of a vector element at a given index, growing the vector as needed
Sets the element at position index to val. If index is past the end of the vector, expands the vector by replicating initval to fill the intervening space.
gtfn gt<T: Ord>(a: &[T], b: &[T]) -> bool
headfn head<T: Copy>(v: &[const T]) -> T
Returns the first element of a vector
initfn init<T: Copy>(v: &[const T]) -> ~[T]
Returns a vector containing all but the last element of a slice
insertfn insert<T>(v: &mut ~[T], i: uint, x: T)
Insert an element at position i within v, shifting all elements after position i one position to the right.
is_emptyfn is_empty<T>(v: &[const T]) -> bool
Returns true if a vector contains no elements
is_not_emptyfn is_not_empty<T>(v: &[const T]) -> bool
Returns true if a vector contains some elements
lastfn last<T: Copy>(v: &[const T]) -> T
Returns the last element of the slice v, failing if the slice is empty.
last_optfn last_opt<T: Copy>(v: &[const T]) -> Option<T>
Returns Some(x) where x is the last element of the slice v, or none if the vector is empty.
lefn le<T: Ord>(a: &[T], b: &[T]) -> bool
lenfn len<T>(v: &[const T]) -> uint
Returns the length of a vector
ltfn lt<T: Ord>(a: &[T], b: &[T]) -> bool
mapfn map<T, U>(v: &[T], f: &fn(t: &T) -> U) -> ~[U]
Apply a function to each element of a vector and return the results
map2fn map2<T: Copy, U: Copy, V>(v0: &[T], v1: &[U], f: &fn(t: &T, v: &U) -> V) ->
~[V]
Apply a function to each pair of elements and return the results
map_consumefn map_consume<T, U>(v: ~[T], f: &fn(v: T) -> U) -> ~[U]
mapifn mapi<T, U>(v: &[T], f: &fn(uint, t: &T) -> U) -> ~[U]
Apply a function to each element of a vector and return the results
mut_viewfn mut_view<T>(v: &r/[mut T], start: uint, end: uint) -> &r/[mut T]
Return a slice that points into another slice.
popfn pop<T>(v: &mut ~[T]) -> T
Remove the last element from a vector and return it
positionfn position<T>(v: &[T], f: &fn(t: &T) -> bool) -> Option<uint>
Find the first index matching some predicate
Apply function f to each element of v. When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
position_betweenfn position_between<T>(v: &[T], start: uint, end: uint, f: &fn(t: &T) -> bool)
-> Option<uint>
Find the first index matching some predicate within a range
Apply function f to each element of v between the range [start, end). When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
position_elemfn position_elem<T: Eq>(v: &[T], x: &T) -> Option<uint>
Find the first index containing a matching value
pushfn push<T>(v: &mut ~[T], initval: T)
Append an element to a vector
push_allfn push_all<T: Copy>(v: &mut ~[T], rhs: &[const T])
push_all_movefn push_all_move<T>(v: &mut ~[T], rhs: ~[T])
push_fastfn push_fast<T>(v: &mut ~[T], initval: T)
push_slowfn push_slow<T>(v: &mut ~[T], initval: T)
removefn remove<T>(v: &mut ~[T], i: uint) -> T
Remove and return the element at position i within v, shifting all elements after position i one position to the left.
reservefn reserve<T>(v: &mut ~[T], n: uint)
Reserves capacity for exactly n elements in the given vector.
If the capacity for v is already equal to or greater than the requested capacity, then no action is taken.
reserve_at_leastfn reserve_at_least<T>(v: &mut ~[T], n: uint)
Reserves capacity for at least n elements in the given vector.
This function will over-allocate in order to amortize the allocation costs in scenarios where the caller may need to repeatedly reserve additional space.
If the capacity for v is already equal to or greater than the requested capacity, then no action is taken.
retainfn retain<T>(v: &mut ~[T], f: &pure fn(t: &T) -> bool)
Like filter(), but in place. Preserves order of v. Linear time.
rev_eachfn rev_each<T>(v: &r/[T], blk: &fn(v: &r/T) -> bool)
Iterates over a vector's elements in reverse
Return true to continue, false to break.
rev_eachifn rev_eachi<T>(v: &r/[T], blk: &fn(i: uint, v: &r/T) -> bool)
Iterates over a vector's elements and indices in reverse
Return true to continue, false to break.
reversefn reverse<T>(v: &[mut T])
Reverse the order of elements in a vector, in place
reversedfn reversed<T: Copy>(v: &[const T]) -> ~[T]
Returns a vector with the order of elements reversed
rfindfn rfind<T: Copy>(v: &[T], f: &fn(t: &T) -> bool) -> Option<T>
Search for the last element that matches a given predicate
Apply function f to each element of v in reverse order. When function f returns true then an option containing the element is returned. If f matches no elements then none is returned.
rfind_betweenfn rfind_between<T: Copy>(v: &[T], start: uint, end: uint,
f: &fn(t: &T) -> bool) -> Option<T>
Search for the last element that matches a given predicate within a range
Apply function f to each element of v in reverse order within the range [start, end). When function f returns true then an option containing the element is returned. If f matches no elements then none is return.
rpositionfn rposition<T>(v: &[T], f: &fn(t: &T) -> bool) -> Option<uint>
Find the last index matching some predicate
Apply function f to each element of v in reverse order. When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
rposition_betweenfn rposition_between<T>(v: &[T], start: uint, end: uint,
f: &fn(t: &T) -> bool) -> Option<uint>
Find the last index matching some predicate within a range
Apply function f to each element of v in reverse order between the range [start, end). When function f returns true then an option containing the index is returned. If f matches no elements then none is returned.
rposition_elemfn rposition_elem<T: Eq>(v: &[T], x: &T) -> Option<uint>
Find the last index containing a matching value
rsplitfn rsplit<T: Copy>(v: &[T], f: &fn(t: &T) -> bool) -> ~[~[T]]
Reverse split the vector v by applying each element against the predicate f.
rsplitnfn rsplitn<T: Copy>(v: &[T], n: uint, f: &fn(t: &T) -> bool) -> ~[~[T]]
Reverse split the vector v by applying each element against the predicate f up to `n times.
same_lengthfn same_length<T, U>(xs: &[const T], ys: &[const U]) -> bool
Returns true if two vectors have the same length
shiftfn shift<T>(v: &mut ~[T]) -> T
Removes the first element from a vector and return it
slicefn slice<T: Copy>(v: &[const T], start: uint, end: uint) -> ~[T]
Returns a copy of the elements from [start..end) from v.
splitfn split<T: Copy>(v: &[T], f: &fn(t: &T) -> bool) -> ~[~[T]]
Split the vector v by applying each element against the predicate f.
splitnfn splitn<T: Copy>(v: &[T], n: uint, f: &fn(t: &T) -> bool) -> ~[~[T]]
Split the vector v by applying each element against the predicate f up to n times.
swapfn swap<T>(v: &[mut T], a: uint, b: uint)
Swaps two elements in a vector
swap_removefn swap_remove<T>(v: &mut ~[T], index: uint) -> T
Remove an element from anywhere in the vector and return it, replacing it with the last element. This does not preserve ordering, but is O(1).
Fails if index >= length.
tailfn tail<T: Copy>(v: &[const T]) -> ~[T]
Returns a vector containing all but the first element of a slice
tailnfn tailn<T: Copy>(v: &[const T], n: uint) -> ~[T]
Returns a vector containing all but the first n \ elements of a slice
to_mutfn to_mut<T>(v: ~[T]) -> ~[mut T]
Produces a mut vector from an immutable vector.
truncatefn truncate<T>(v: &mut ~[T], newlen: uint)
Shorten a vector, dropping excess elements.
unshiftfn unshift<T>(v: &mut ~[T], x: T)
Prepend an element to the vector
unzipfn unzip<T, U>(v: ~[(T, U)]) -> (~[T], ~[U])
Convert a vector of pairs into a pair of vectors.
Returns a tuple containing two vectors where the i-th element of the first vector contains the first element of the i-th tuple of the input vector, and the i-th element of the second vector contains the second element of the i-th tuple of the input vector.
unzip_slicefn unzip_slice<T: Copy, U: Copy>(v: &[(T, U)]) -> (~[T], ~[U])
Convert a vector of pairs into a pair of vectors, by reference. As unzip().
viewfn view<T>(v: &r/[T], start: uint, end: uint) -> &r/[T]
Return a slice that points into another slice.
windowedfn windowed<TT: Copy>(nn: uint, xx: &[TT]) -> ~[~[TT]]
with_capacityfn with_capacity<T>(capacity: uint) -> ~[T]
zipfn zip<T, U>(v: ~[T], u: ~[U]) -> ~[(T, U)]
Convert two vectors to a vector of pairs.
Returns a vector of tuples, where the i-th tuple contains contains the i-th elements from each of the input vectors.
zip_slicefn zip_slice<T: Copy, U: Copy>(v: &[const T], u: &[const U]) -> ~[(T, U)]
Convert two vectors to a vector of pairs, by reference. As zip().