File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -579,19 +579,19 @@ pub mod traits {
579
579
fn gt ( & self , other : & ~[ T ] ) -> bool { self . as_slice ( ) > other. as_slice ( ) }
580
580
}
581
581
582
- impl < ' a , T : Clone , V : Vector < T > > Add < V , ~ [ T ] > for & ' a [ T ] {
582
+ impl < ' a , T : Clone , V : Vector < T > > Add < V , Vec < T > > for & ' a [ T ] {
583
583
#[ inline]
584
- fn add ( & self , rhs : & V ) -> ~ [ T ] {
584
+ fn add ( & self , rhs : & V ) -> Vec < T > {
585
585
let mut res = Vec :: with_capacity ( self . len ( ) + rhs. as_slice ( ) . len ( ) ) ;
586
586
res. push_all ( * self ) ;
587
587
res. push_all ( rhs. as_slice ( ) ) ;
588
- res. move_iter ( ) . collect ( )
588
+ res
589
589
}
590
590
}
591
591
592
- impl < T : Clone , V : Vector < T > > Add < V , ~ [ T ] > for ~[ T ] {
592
+ impl < T : Clone , V : Vector < T > > Add < V , Vec < T > > for ~[ T ] {
593
593
#[ inline]
594
- fn add ( & self , rhs : & V ) -> ~ [ T ] {
594
+ fn add ( & self , rhs : & V ) -> Vec < T > {
595
595
self . as_slice ( ) + rhs. as_slice ( )
596
596
}
597
597
}
Original file line number Diff line number Diff line change @@ -18,13 +18,16 @@ A simple wrapper over the platform's dynamic library facilities
18
18
19
19
use c_str:: ToCStr ;
20
20
use cast;
21
+ use iter:: Iterator ;
21
22
use ops:: * ;
22
23
use option:: * ;
23
24
use os;
24
25
use path:: GenericPath ;
25
26
use path;
26
27
use result:: * ;
28
+ use slice:: { Vector , OwnedVector } ;
27
29
use str;
30
+ use vec:: Vec ;
28
31
29
32
pub struct DynamicLibrary { handle : * u8 }
30
33
@@ -73,8 +76,10 @@ impl DynamicLibrary {
73
76
( "LD_LIBRARY_PATH" , ':' as u8 )
74
77
} ;
75
78
let newenv = os:: getenv_as_bytes ( envvar) . unwrap_or ( box [ ] ) ;
76
- let newenv = newenv + & [ sep] + path. as_vec ( ) ;
77
- os:: setenv ( envvar, str:: from_utf8 ( newenv) . unwrap ( ) ) ;
79
+ let mut newenv = newenv. move_iter ( ) . collect :: < Vec < _ > > ( ) ;
80
+ newenv. push_all ( & [ sep] ) ;
81
+ newenv. push_all ( path. as_vec ( ) ) ;
82
+ os:: setenv ( envvar, str:: from_utf8 ( newenv. as_slice ( ) ) . unwrap ( ) ) ;
78
83
}
79
84
80
85
/// Access the value at the symbol of the dynamic library
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ use mem::{size_of, move_val_init};
22
22
use mem;
23
23
use num;
24
24
use num:: { CheckedMul , CheckedAdd } ;
25
- use ops:: Drop ;
25
+ use ops:: { Add , Drop } ;
26
26
use option:: { None , Option , Some } ;
27
27
use ptr:: RawPtr ;
28
28
use ptr;
@@ -1369,6 +1369,16 @@ impl<T> Vector<T> for Vec<T> {
1369
1369
}
1370
1370
}
1371
1371
1372
+ impl < T : Clone , V : Vector < T > > Add < V , Vec < T > > for Vec < T > {
1373
+ #[ inline]
1374
+ fn add ( & self , rhs : & V ) -> Vec < T > {
1375
+ let mut res = Vec :: with_capacity ( self . len ( ) + rhs. as_slice ( ) . len ( ) ) ;
1376
+ res. push_all ( self . as_slice ( ) ) ;
1377
+ res. push_all ( rhs. as_slice ( ) ) ;
1378
+ res
1379
+ }
1380
+ }
1381
+
1372
1382
#[ unsafe_destructor]
1373
1383
impl < T > Drop for Vec < T > {
1374
1384
fn drop ( & mut self ) {
You can’t perform that action at this time.
0 commit comments