@@ -18,8 +18,7 @@ pub mod flatcontainer;
1818/// We require the container to be cloneable to enable efficient copies when providing references
1919/// of containers to operators. Care must be taken that the type's `clone_from` implementation
2020/// is efficient (which is not necessarily the case when deriving `Clone`.)
21- /// TODO: Don't require `Container: Clone`
22- pub trait Container : Default + Clone + ' static {
21+ pub trait Container : Default {
2322 /// The type of elements when reading non-destructively from the container.
2423 type ItemRef < ' a > where Self : ' a ;
2524
@@ -50,13 +49,13 @@ pub trait Container: Default + Clone + 'static {
5049 fn clear ( & mut self ) ;
5150
5251 /// Iterator type when reading from the container.
53- type Iter < ' a > : Iterator < Item =Self :: ItemRef < ' a > > ;
52+ type Iter < ' a > : Iterator < Item =Self :: ItemRef < ' a > > where Self : ' a ;
5453
5554 /// Returns an iterator that reads the contents of this container.
5655 fn iter ( & self ) -> Self :: Iter < ' _ > ;
5756
5857 /// Iterator type when draining the container.
59- type DrainIter < ' a > : Iterator < Item =Self :: Item < ' a > > ;
58+ type DrainIter < ' a > : Iterator < Item =Self :: Item < ' a > > where Self : ' a ;
6059
6160 /// Returns an iterator that drains the contents of this container.
6261 /// Drain leaves the container in an undefined state.
@@ -104,7 +103,7 @@ pub trait PushInto<T> {
104103/// decide to represent a push order for `extract` and `finish`, or not.
105104pub trait ContainerBuilder : Default + ' static {
106105 /// The container type we're building.
107- type Container : Container ;
106+ type Container : Container + Clone + ' static ;
108107 /// Extract assembled containers, potentially leaving unfinished data behind. Can
109108 /// be called repeatedly, for example while the caller can send data.
110109 ///
@@ -160,7 +159,7 @@ impl<T, C: SizableContainer + PushInto<T>> PushInto<T> for CapacityContainerBuil
160159 }
161160}
162161
163- impl < C : Container > ContainerBuilder for CapacityContainerBuilder < C > {
162+ impl < C : Container + Clone + ' static > ContainerBuilder for CapacityContainerBuilder < C > {
164163 type Container = C ;
165164
166165 #[ inline]
@@ -204,7 +203,7 @@ impl<C: Container> CapacityContainerBuilder<C> {
204203 }
205204}
206205
207- impl < T : Clone + ' static > Container for Vec < T > {
206+ impl < T > Container for Vec < T > {
208207 type ItemRef < ' a > = & ' a T where T : ' a ;
209208 type Item < ' a > = T where T : ' a ;
210209
@@ -218,20 +217,20 @@ impl<T: Clone + 'static> Container for Vec<T> {
218217
219218 fn clear ( & mut self ) { Vec :: clear ( self ) }
220219
221- type Iter < ' a > = std:: slice:: Iter < ' a , T > ;
220+ type Iter < ' a > = std:: slice:: Iter < ' a , T > where Self : ' a ;
222221
223222 fn iter ( & self ) -> Self :: Iter < ' _ > {
224223 self . as_slice ( ) . iter ( )
225224 }
226225
227- type DrainIter < ' a > = std:: vec:: Drain < ' a , T > ;
226+ type DrainIter < ' a > = std:: vec:: Drain < ' a , T > where Self : ' a ;
228227
229228 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
230229 self . drain ( ..)
231230 }
232231}
233232
234- impl < T : Clone + ' static > SizableContainer for Vec < T > {
233+ impl < T > SizableContainer for Vec < T > {
235234 fn capacity ( & self ) -> usize {
236235 self . capacity ( )
237236 }
@@ -294,13 +293,13 @@ mod rc {
294293 }
295294 }
296295
297- type Iter < ' a > = T :: Iter < ' a > ;
296+ type Iter < ' a > = T :: Iter < ' a > where Self : ' a ;
298297
299298 fn iter ( & self ) -> Self :: Iter < ' _ > {
300299 self . deref ( ) . iter ( )
301300 }
302301
303- type DrainIter < ' a > = T :: Iter < ' a > ;
302+ type DrainIter < ' a > = T :: Iter < ' a > where Self : ' a ;
304303
305304 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
306305 self . iter ( )
@@ -335,13 +334,13 @@ mod arc {
335334 }
336335 }
337336
338- type Iter < ' a > = T :: Iter < ' a > ;
337+ type Iter < ' a > = T :: Iter < ' a > where Self : ' a ;
339338
340339 fn iter ( & self ) -> Self :: Iter < ' _ > {
341340 self . deref ( ) . iter ( )
342341 }
343342
344- type DrainIter < ' a > = T :: Iter < ' a > ;
343+ type DrainIter < ' a > = T :: Iter < ' a > where Self : ' a ;
345344
346345 fn drain ( & mut self ) -> Self :: DrainIter < ' _ > {
347346 self . iter ( )
0 commit comments