yewstack / implicit-clone

Immutable types and ImplicitClone trait similar to Copy
19 stars 10 forks source link

Remove opaque type on function iter() of IArray #40

Closed cecton closed 1 year ago

cecton commented 1 year ago

This change is necessary for me to work on NodeSeq on Yew as there is an trait there that is impossible to implement if the iter() method here returns an opaque type.

-impl<IN, OUT> IntoIterator for NodeSeq<IN, OUT> {
+impl<IN, OUT: ImplicitClone + 'static> IntoIterator for NodeSeq<IN, OUT> {
     type IntoIter = std::vec::IntoIter<Self::Item>; // this should be the "Iter" type of IArray
     type Item = OUT;

     fn into_iter(self) -> Self::IntoIter {
-        self.0.into_iter()
+        self.0.iter().collect::<Vec<_>>().into_iter() // terrible temporary workaround
     }
 }