File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 11use std:: pin:: Pin ;
22use std:: borrow:: Cow ;
3+ use std:: sync:: Arc ;
4+ use std:: rc:: Rc ;
35
46use crate :: stream:: { Extend , FromStream , IntoStream } ;
57
@@ -58,3 +60,39 @@ impl<T> FromStream<T> for Box<[T]> {
5860 } )
5961 }
6062}
63+
64+ impl < T > FromStream < T > for Rc < [ T ] > {
65+ #[ inline]
66+ fn from_stream < ' a , S : IntoStream < Item = T > > (
67+ stream : S ,
68+ ) -> Pin < Box < dyn core:: future:: Future < Output = Self > + ' a > >
69+ where
70+ <S as IntoStream >:: IntoStream : ' a ,
71+ {
72+ let stream = stream. into_stream ( ) ;
73+
74+ Box :: pin ( async move {
75+ pin_utils:: pin_mut!( stream) ;
76+
77+ Vec :: from_stream ( stream) . await . into ( )
78+ } )
79+ }
80+ }
81+
82+ impl < T > FromStream < T > for Arc < [ T ] > {
83+ #[ inline]
84+ fn from_stream < ' a , S : IntoStream < Item = T > > (
85+ stream : S ,
86+ ) -> Pin < Box < dyn core:: future:: Future < Output = Self > + ' a > >
87+ where
88+ <S as IntoStream >:: IntoStream : ' a ,
89+ {
90+ let stream = stream. into_stream ( ) ;
91+
92+ Box :: pin ( async move {
93+ pin_utils:: pin_mut!( stream) ;
94+
95+ Vec :: from_stream ( stream) . await . into ( )
96+ } )
97+ }
98+ }
You can’t perform that action at this time.
0 commit comments