1- use std:: pin:: Pin ;
21use std:: borrow:: Cow ;
2+ use std:: pin:: Pin ;
33
44use crate :: prelude:: * ;
55use crate :: stream:: { Extend , IntoStream } ;
@@ -23,7 +23,10 @@ impl<'b> Extend<&'b char> for String {
2323 fn stream_extend < ' a , S : IntoStream < Item = & ' b char > + ' a > (
2424 & ' a mut self ,
2525 stream : S ,
26- ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > > where ' b : ' a {
26+ ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > >
27+ where
28+ ' b : ' a ,
29+ {
2730 //TODO: Box::pin(stream.into_stream().copied())
2831 unimplemented ! ( )
2932 }
@@ -33,7 +36,10 @@ impl<'b> Extend<&'b str> for String {
3336 fn stream_extend < ' a , S : IntoStream < Item = & ' b str > + ' a > (
3437 & ' a mut self ,
3538 stream : S ,
36- ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > > where ' b : ' a {
39+ ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > >
40+ where
41+ ' b : ' a ,
42+ {
3743 //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(s))
3844 Box :: pin ( stream. into_stream ( ) . fold ( ( ) , move |( ) , s| self . push_str ( s) ) )
3945 }
@@ -45,16 +51,27 @@ impl Extend<String> for String {
4551 stream : S ,
4652 ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > > {
4753 //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(&s))
48- Box :: pin ( stream. into_stream ( ) . fold ( ( ) , move |( ) , s| self . push_str ( & s) ) )
54+ Box :: pin (
55+ stream
56+ . into_stream ( )
57+ . fold ( ( ) , move |( ) , s| self . push_str ( & s) ) ,
58+ )
4959 }
5060}
5161
5262impl < ' b > Extend < Cow < ' b , str > > for String {
5363 fn stream_extend < ' a , S : IntoStream < Item = Cow < ' b , str > > + ' a > (
5464 & ' a mut self ,
5565 stream : S ,
56- ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > > where ' b : ' a {
66+ ) -> Pin < Box < dyn Future < Output = ( ) > + ' a > >
67+ where
68+ ' b : ' a ,
69+ {
5770 //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(&s))
58- Box :: pin ( stream. into_stream ( ) . fold ( ( ) , move |( ) , s| self . push_str ( & s) ) )
71+ Box :: pin (
72+ stream
73+ . into_stream ( )
74+ . fold ( ( ) , move |( ) , s| self . push_str ( & s) ) ,
75+ )
5976 }
6077}
0 commit comments