You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
415 B
14 lines
415 B
#[test]
|
|
fn peekable() {
|
|
use futures::executor::block_on;
|
|
use futures::pin_mut;
|
|
use futures::stream::{self, Peekable, StreamExt};
|
|
|
|
block_on(async {
|
|
let peekable: Peekable<_> = stream::iter(vec![1u8, 2, 3]).peekable();
|
|
pin_mut!(peekable);
|
|
assert_eq!(peekable.as_mut().peek().await, Some(&1u8));
|
|
assert_eq!(peekable.collect::<Vec<u8>>().await, vec![1, 2, 3]);
|
|
});
|
|
}
|