@@ -68,6 +68,7 @@ pub fn append<T:Clone>(lhs: @[T], rhs: &[T]) -> @[T] {
68
68
69
69
70
70
/// Apply a function to each element of a vector and return the results
71
+ #[ inline]
71
72
pub fn map < T , U > ( v : & [ T ] , f: |x: & T | -> U ) -> @[ U ] {
72
73
build ( Some ( v. len ( ) ) , |push| {
73
74
for elem in v. iter ( ) {
@@ -82,6 +83,7 @@ pub fn map<T, U>(v: &[T], f: |x: &T| -> U) -> @[U] {
82
83
* Creates an immutable vector of size `n_elts` and initializes the elements
83
84
* to the value returned by the function `op`.
84
85
*/
86
+ #[ inline]
85
87
pub fn from_fn < T > ( n_elts : uint , op: |uint| -> T ) -> @[ T ] {
86
88
build ( Some ( n_elts) , |push| {
87
89
let mut i: uint = 0 u;
@@ -95,6 +97,7 @@ pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> @[T] {
95
97
* Creates an immutable vector of size `n_elts` and initializes the elements
96
98
* to the value `t`.
97
99
*/
100
+ #[ inline]
98
101
pub fn from_elem < T : Clone > ( n_elts : uint , t : T ) -> @[ T ] {
99
102
build ( Some ( n_elts) , |push| {
100
103
let mut i: uint = 0 u;
@@ -109,6 +112,7 @@ pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> @[T] {
109
112
* Creates and initializes an immutable managed vector by moving all the
110
113
* elements from an owned vector.
111
114
*/
115
+ #[ inline]
112
116
pub fn to_managed_move < T > ( v : ~[ T ] ) -> @[ T ] {
113
117
let mut av = @[ ] ;
114
118
unsafe {
@@ -124,6 +128,7 @@ pub fn to_managed_move<T>(v: ~[T]) -> @[T] {
124
128
* Creates and initializes an immutable managed vector by copying all the
125
129
* elements of a slice.
126
130
*/
131
+ #[ inline]
127
132
pub fn to_managed < T : Clone > ( v : & [ T ] ) -> @[ T ] {
128
133
from_fn ( v. len ( ) , |i| v[ i] . clone ( ) )
129
134
}
@@ -135,6 +140,7 @@ impl<T> Clone for @[T] {
135
140
}
136
141
137
142
impl < A > FromIterator < A > for @[ A ] {
143
+ #[ inline]
138
144
fn from_iterator < T : Iterator < A > > ( iterator : & mut T ) -> @[ A ] {
139
145
let ( lower, _) = iterator. size_hint ( ) ;
140
146
build ( Some ( lower) , |push| {
@@ -216,6 +222,7 @@ pub mod raw {
216
222
move_val_init ( & mut ( * p) , initval) ;
217
223
}
218
224
225
+ #[ inline]
219
226
unsafe fn push_slow < T > ( v : & mut @[ T ] , initval : T ) {
220
227
reserve_at_least ( v, v. len ( ) + 1 u) ;
221
228
push_fast ( v, initval) ;
@@ -232,6 +239,7 @@ pub mod raw {
232
239
* * v - A vector
233
240
* * n - The number of elements to reserve space for
234
241
*/
242
+ #[ inline]
235
243
pub unsafe fn reserve < T > ( v : & mut @[ T ] , n : uint ) {
236
244
// Only make the (slow) call into the runtime if we have to
237
245
if capacity ( * v) < n {
@@ -243,6 +251,7 @@ pub mod raw {
243
251
244
252
// Implementation detail. Shouldn't be public
245
253
#[ allow( missing_doc) ]
254
+ #[ inline]
246
255
pub fn reserve_raw ( ty : * TyDesc , ptr : * mut * mut Box < Vec < ( ) > > , n : uint ) {
247
256
// check for `uint` overflow
248
257
unsafe {
@@ -257,6 +266,7 @@ pub mod raw {
257
266
}
258
267
}
259
268
269
+ #[ inline]
260
270
fn local_realloc ( ptr : * ( ) , size : uint ) -> * ( ) {
261
271
use rt:: local:: Local ;
262
272
use rt:: task:: Task ;
@@ -281,6 +291,7 @@ pub mod raw {
281
291
* * v - A vector
282
292
* * n - The number of elements to reserve space for
283
293
*/
294
+ #[ inline]
284
295
pub unsafe fn reserve_at_least < T > ( v : & mut @[ T ] , n : uint ) {
285
296
reserve ( v, uint:: next_power_of_two ( n) ) ;
286
297
}
0 commit comments