SliceRepr
VecRepr
push
- Pushes a new value onto this vector.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.set_len
- Sets the length of a vectorSliceRepr
type SliceRepr = vec::raw::SliceRepr
VecRepr
type VecRepr = vec::raw::VecRepr
push
unsafe fn push<T>(v: &mut @[T], initval: T)
Pushes a new value onto this vector.
reserve
unsafe fn 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_least
unsafe fn 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.
set_len
unsafe fn set_len<T>(v: @[T], new_len: uint)
Sets the length of a vector
This will explicitly set the size of the vector, without actually modifing its buffers, so it is up to the caller to ensure that the vector is actually the specified size.