Skip to content

Commit 20a228f

Browse files
committed
Relax Unpin dep for Stream in stream::map
1 parent 4c2daad commit 20a228f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/stream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ pub async fn collect<St, C>(stream: St) -> C
2525

2626
pub fn map<St, U, F>(stream: St, f: F) -> impl Stream<Item = U>
2727
where F: FnMut(St::Item) -> U,
28-
St: Stream + Unpin,
28+
St: Stream,
2929
{
30-
futures::stream::unfold((stream, f), async move |(mut stream, mut f)| {
30+
let stream = Box::pin(stream);
31+
futures::stream::unfold((stream, f), async move | (mut stream, mut f)| {
3132
let item = await!(next(&mut stream));
3233
item.map(|item| (f(item), (stream, f)))
3334
})

0 commit comments

Comments
 (0)