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] {
7777}
7878
7979priv impl < A > DVec < A > {
80+ #[ inline( always) ]
8081 pure fn check_not_borrowed ( ) {
8182 unsafe {
8283 let data: * ( ) = cast:: reinterpret_cast ( & self . data ) ;
@@ -137,17 +138,14 @@ impl<A> DVec<A> {
137138 }
138139
139140 /// Returns the number of elements currently in the dvec
141+ #[ inline( always) ]
140142 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 ( ) ;
148145 }
149146
150147 /// Overwrite the current contents
148+ #[ inline( always) ]
151149 fn set ( w : ~[ A ] ) {
152150 self . check_not_borrowed ( ) ;
153151 self . data = move w;
@@ -178,6 +176,7 @@ impl<A> DVec<A> {
178176 }
179177
180178 /// Append a single item to the end of the list
179+ #[inline(always)]
181180 fn push(t: A) {
182181 self.check_not_borrowed();
183182 self.data.push(move t);
@@ -354,6 +353,7 @@ impl<A: Copy> DVec<A> {
354353}
355354
356355impl < A : Copy > DVec < A > : Index < uint , A > {
356+ #[ inline( always) ]
357357 pure fn index ( idx : uint ) -> A {
358358 self . get_elt ( idx)
359359 }
You can’t perform that action at this time.
0 commit comments