@@ -16,8 +16,7 @@ pub mod flatcontainer;
1616/// We require the container to be cloneable to enable efficient copies when providing references
1717/// of containers to operators. Care must be taken that the type's `clone_from` implementation
1818/// is efficient (which is not necessarily the case when deriving `Clone`.)
19- /// TODO: Don't require `Container: Clone`
20- pub trait Container : Default + Clone + ' static {
19+ pub trait Container : Default {
2120 /// The type of elements when reading non-destructively from the container.
2221 type ItemRef < ' a > where Self : ' a ;
2322
@@ -42,13 +41,13 @@ pub trait Container: Default + Clone + 'static {
4241 fn clear ( & mut self ) ;
4342
4443 /// Iterator type when reading from the container.
45- type Iter < ' a > : Iterator < Item =Self :: ItemRef < ' a > > ;
44+ type Iter < ' a > : Iterator < Item =Self :: ItemRef < ' a > > where Self : ' a ;
4645
4746 /// Returns an iterator that reads the contents of this container.
4847 fn iter ( & self ) -> Self :: Iter < ' _ > ;
4948
5049 /// Iterator type when draining the container.
51- type DrainIter < ' a > : Iterator < Item =Self :: Item < ' a > > ;
50+ type DrainIter < ' a > : Iterator < Item =Self :: Item < ' a > > where Self : ' a ;
5251
5352 /// Returns an iterator that drains the contents of this container.
5453 /// Drain leaves the container in an undefined state.
@@ -83,7 +82,7 @@ pub trait PushContainer: Container {
8382 fn reserve ( & mut self , additional : usize ) ;
8483}
8584
86- impl < T : Clone + ' static > Container for Vec < T > {
85+ impl < T > Container for Vec < T > {
8786 type ItemRef < ' a > = & ' a T where T : ' a ;
8887 type Item < ' a > = T where T : ' a ;
8988
@@ -97,13 +96,13 @@ impl<T: Clone + 'static> Container for Vec<T> {
9796
9897 fn clear ( & mut self ) { Vec :: clear ( self ) }
9998
100- type Iter < ' a > = std:: slice:: Iter < ' a , T > ;
99+ type Iter < ' a > = std:: slice:: Iter < ' a , T > where Self : ' a ;
101100
102101 fn iter ( & self ) -> Self :: Iter < ' _ > {
103102 self . as_slice ( ) . iter ( )
104103 }
105104
106- type DrainIter < ' a > = std:: vec:: Drain < ' a , T > ;
105+ type DrainIter < ' a > = std:: vec:: Drain < ' a , T > where Self : ' a ;
107106
108107 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
109108 self . drain ( ..)
@@ -165,13 +164,13 @@ mod rc {
165164 }
166165 }
167166
168- type Iter < ' a > = T :: Iter < ' a > ;
167+ type Iter < ' a > = T :: Iter < ' a > where Self : ' a ;
169168
170169 fn iter ( & self ) -> Self :: Iter < ' _ > {
171170 self . deref ( ) . iter ( )
172171 }
173172
174- type DrainIter < ' a > = T :: Iter < ' a > ;
173+ type DrainIter < ' a > = T :: Iter < ' a > where Self : ' a ;
175174
176175 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
177176 self . iter ( )
@@ -206,13 +205,13 @@ mod arc {
206205 }
207206 }
208207
209- type Iter < ' a > = T :: Iter < ' a > ;
208+ type Iter < ' a > = T :: Iter < ' a > where Self : ' a ;
210209
211210 fn iter ( & self ) -> Self :: Iter < ' _ > {
212211 self . deref ( ) . iter ( )
213212 }
214213
215- type DrainIter < ' a > = T :: Iter < ' a > ;
214+ type DrainIter < ' a > = T :: Iter < ' a > where Self : ' a ;
216215
217216 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
218217 self . iter ( )
@@ -232,7 +231,7 @@ pub trait PushPartitioned: PushContainer {
232231 F : FnMut ( usize , & mut Self ) ;
233232}
234233
235- impl < T : PushContainer + ' static > PushPartitioned for T where for < ' a > T :: Item < ' a > : PushInto < T > {
234+ impl < T : PushContainer > PushPartitioned for T where for < ' a > T :: Item < ' a > : PushInto < T > {
236235 fn push_partitioned < I , F > ( & mut self , buffers : & mut [ Self ] , mut index : I , mut flush : F )
237236 where
238237 for < ' a > I : FnMut ( & Self :: Item < ' a > ) -> usize ,
0 commit comments