You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling .chunks(n) on a stream of zero-sized items produces a stream that waits until the original stream terminates, and then yields all the items at once, regardless of the value of n.
use futures::stream::{self, Stream};
fn main() {
let val = ();
for i in stream::repeat::<_, ()>(val).take(5).chunks(3).wait() {
dbg!(i).ok();
}
}
Actual output:
[src/main.rs:6] i = Ok(
[
(),
(),
(),
(),
()
]
)
Expected output:
[src/main.rs:6] i = Ok(
[
(),
(),
()
]
)
[src/main.rs:6] i = Ok(
[
(),
()
]
)
Chunks should probably hold its own cap: usize field rather than relying on items.capacity(), because Vec::<()> reports capacity of usize::MAX regardless of what capacity was requested.
The text was updated successfully, but these errors were encountered:
Calling
.chunks(n)
on a stream of zero-sized items produces a stream that waits until the original stream terminates, and then yields all the items at once, regardless of the value ofn
.Actual output:
Expected output:
Chunks
should probably hold its owncap: usize
field rather than relying onitems.capacity()
, becauseVec::<()>
reports capacity ofusize::MAX
regardless of what capacity was requested.The text was updated successfully, but these errors were encountered: