@@ -1599,13 +1599,6 @@ pub trait ImmutableVector<T> {
1599
1599
pure fn filter_map < U : Copy > ( f : fn ( t : & T ) -> Option < U > ) -> ~[ U ] ;
1600
1600
}
1601
1601
1602
- pub trait ImmutableEqVector < T : Eq > {
1603
- pure fn position ( f : fn ( t : & T ) -> bool ) -> Option < uint > ;
1604
- pure fn position_elem ( t : & T ) -> Option < uint > ;
1605
- pure fn rposition ( f : fn ( t : & T ) -> bool ) -> Option < uint > ;
1606
- pure fn rposition_elem ( t : & T ) -> Option < uint > ;
1607
- }
1608
-
1609
1602
/// Extension methods for vectors
1610
1603
impl < T > & [ T ] : ImmutableVector < T > {
1611
1604
/// Return a slice that points into another slice.
@@ -1671,6 +1664,13 @@ impl<T> &[T]: ImmutableVector<T> {
1671
1664
}
1672
1665
}
1673
1666
1667
+ pub trait ImmutableEqVector < T : Eq > {
1668
+ pure fn position ( f : fn ( t : & T ) -> bool ) -> Option < uint > ;
1669
+ pure fn position_elem ( t : & T ) -> Option < uint > ;
1670
+ pure fn rposition ( f : fn ( t : & T ) -> bool ) -> Option < uint > ;
1671
+ pure fn rposition_elem ( t : & T ) -> Option < uint > ;
1672
+ }
1673
+
1674
1674
impl < T : Eq > & [ T ] : ImmutableEqVector < T > {
1675
1675
/**
1676
1676
* Find the first index matching some predicate
@@ -1740,7 +1740,7 @@ impl<T: Copy> &[T]: ImmutableCopyableVector<T> {
1740
1740
pure fn rfind ( f : fn ( t : & T ) -> bool ) -> Option < T > { rfind ( self , f) }
1741
1741
}
1742
1742
1743
- pub trait MutableVector < T > {
1743
+ pub trait OwnedVector < T > {
1744
1744
fn push ( & mut self , t : T ) ;
1745
1745
fn push_all_move ( & mut self , rhs : ~[ T ] ) ;
1746
1746
fn pop ( & mut self ) -> T ;
@@ -1753,18 +1753,7 @@ pub trait MutableVector<T> {
1753
1753
fn retain ( & mut self , f : pure fn( t : & T ) -> bool ) ;
1754
1754
}
1755
1755
1756
- pub trait MutableCopyableVector < T : Copy > {
1757
- fn push_all ( & mut self , rhs : & [ const T ] ) ;
1758
- fn grow ( & mut self , n : uint , initval : & T ) ;
1759
- fn grow_fn ( & mut self , n : uint , op : iter:: InitOp < T > ) ;
1760
- fn grow_set ( & mut self , index : uint , initval : & T , val : T ) ;
1761
- }
1762
-
1763
- trait MutableEqVector < T : Eq > {
1764
- fn dedup ( & mut self ) ;
1765
- }
1766
-
1767
- impl < T > ~[ T ] : MutableVector < T > {
1756
+ impl < T > ~[ T ] : OwnedVector < T > {
1768
1757
#[ inline]
1769
1758
fn push ( & mut self , t : T ) {
1770
1759
push ( self , t) ;
@@ -1817,7 +1806,14 @@ impl<T> ~[T]: MutableVector<T> {
1817
1806
1818
1807
}
1819
1808
1820
- impl < T : Copy > ~[ T ] : MutableCopyableVector < T > {
1809
+ pub trait OwnedCopyableVector < T : Copy > {
1810
+ fn push_all ( & mut self , rhs : & [ const T ] ) ;
1811
+ fn grow ( & mut self , n : uint , initval : & T ) ;
1812
+ fn grow_fn ( & mut self , n : uint , op : iter:: InitOp < T > ) ;
1813
+ fn grow_set ( & mut self , index : uint , initval : & T , val : T ) ;
1814
+ }
1815
+
1816
+ impl < T : Copy > ~[ T ] : OwnedCopyableVector < T > {
1821
1817
#[ inline]
1822
1818
fn push_all ( & mut self , rhs : & [ const T ] ) {
1823
1819
push_all ( self , rhs) ;
@@ -1839,14 +1835,17 @@ impl<T: Copy> ~[T]: MutableCopyableVector<T> {
1839
1835
}
1840
1836
}
1841
1837
1842
- impl < T : Eq > ~[ T ] : MutableEqVector < T > {
1838
+ trait OwnedEqVector < T : Eq > {
1839
+ fn dedup ( & mut self ) ;
1840
+ }
1841
+
1842
+ impl < T : Eq > ~[ T ] : OwnedEqVector < T > {
1843
1843
#[ inline]
1844
1844
fn dedup ( & mut self ) {
1845
1845
dedup ( self )
1846
1846
}
1847
1847
}
1848
1848
1849
-
1850
1849
/**
1851
1850
* Constructs a vector from an unsafe pointer to a buffer
1852
1851
*
0 commit comments