@@ -217,10 +217,13 @@ impl<P: Page> ItemIterator<P> {
217
217
/// Creates a [`ItemIterator<P>`] from a raw stream of [`Result<P>`](typespec::Result<P>) values.
218
218
///
219
219
/// This constructor is used when you are implementing a completely custom stream and want to use it as a pager.
220
- pub fn from_stream < S > ( stream : S ) -> Self
221
- where
222
- S : Stream < Item = Result < P , Error > > + Send + ' static ,
223
- {
220
+ pub fn from_stream <
221
+ // This is a bit gnarly, but the only thing that differs between the WASM/non-WASM configs is the presence of Send bounds.
222
+ #[ cfg( not( target_arch = "wasm32" ) ) ] S : Stream < Item = Result < P , Error > > + Send + ' static ,
223
+ #[ cfg( target_arch = "wasm32" ) ] S : Stream < Item = Result < P , Error > > + ' static ,
224
+ > (
225
+ stream : S ,
226
+ ) -> Self {
224
227
Self {
225
228
stream : Box :: pin ( stream) ,
226
229
current : None ,
@@ -396,10 +399,13 @@ impl<P> PageIterator<P> {
396
399
/// Creates a [`PageIterator<P>`] from a raw stream of [`Result<P>`](typespec::Result<P>) values.
397
400
///
398
401
/// This constructor is used when you are implementing a completely custom stream and want to use it as a pager.
399
- pub fn from_stream < S > ( stream : S ) -> Self
400
- where
401
- S : Stream < Item = Result < P , Error > > + Send + ' static ,
402
- {
402
+ pub fn from_stream <
403
+ // This is a bit gnarly, but the only thing that differs between the WASM/non-WASM configs is the presence of Send bounds.
404
+ #[ cfg( not( target_arch = "wasm32" ) ) ] S : Stream < Item = Result < P , Error > > + Send + ' static ,
405
+ #[ cfg( target_arch = "wasm32" ) ] S : Stream < Item = Result < P , Error > > + ' static ,
406
+ > (
407
+ stream : S ,
408
+ ) -> Self {
403
409
Self {
404
410
stream : Box :: pin ( stream) ,
405
411
}
0 commit comments