File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ pub fn unwrap<A>(d: DVec<A>) -> ~[A] {
77
77
}
78
78
79
79
priv impl < A > DVec < A > {
80
+ #[ inline( always) ]
80
81
pure fn check_not_borrowed ( ) {
81
82
unsafe {
82
83
let data: * ( ) = cast:: reinterpret_cast ( & self . data ) ;
@@ -137,17 +138,14 @@ impl<A> DVec<A> {
137
138
}
138
139
139
140
/// Returns the number of elements currently in the dvec
141
+ #[ inline( always) ]
140
142
pure fn len ( ) -> uint {
141
- unsafe {
142
- do self . check_out |v| {
143
- let l = v. len ( ) ;
144
- self . give_back ( move v) ;
145
- l
146
- }
147
- }
143
+ self . check_not_borrowed ( ) ;
144
+ return self . data . len ( ) ;
148
145
}
149
146
150
147
/// Overwrite the current contents
148
+ #[ inline( always) ]
151
149
fn set ( w : ~[ A ] ) {
152
150
self . check_not_borrowed ( ) ;
153
151
self . data = move w;
@@ -178,6 +176,7 @@ impl<A> DVec<A> {
178
176
}
179
177
180
178
/// Append a single item to the end of the list
179
+ #[inline(always)]
181
180
fn push(t: A) {
182
181
self.check_not_borrowed();
183
182
self.data.push(move t);
@@ -354,6 +353,7 @@ impl<A: Copy> DVec<A> {
354
353
}
355
354
356
355
impl < A : Copy > DVec < A > : Index < uint , A > {
356
+ #[ inline( always) ]
357
357
pure fn index ( idx : uint ) -> A {
358
358
self . get_elt ( idx)
359
359
}
You can’t perform that action at this time.
0 commit comments