core: Make vec::push faster

This way makes it equivalent to the compiler's vec push, and is a lot
faster than calling vec::grow.
This commit is contained in:
Brian Anderson 2012-02-17 18:15:49 -08:00
parent affd83ea0e
commit 3411d19369
1 changed files with 3 additions and 2 deletions

View File

@ -409,13 +409,14 @@ fn pop<T>(&v: [const T]) -> T unsafe {
val
}
#[inline]
/*
Function: push
Append an element to a vector and return it
Append an element to a vector
*/
fn push<T: copy>(&v: [T], initval: T) {
grow(v, 1u, initval)
v += [initval];
}
// TODO: More.