Crates.io | change_stream |
lib.rs | change_stream |
version | 0.1.0 |
source | src |
created_at | 2023-06-29 18:53:31.625126 |
updated_at | 2023-06-29 18:53:31.625126 |
description | A Stream that only emits if the value is different. |
homepage | |
repository | https://github.com/andrewlowndes/change_stream |
max_upload_size | |
id | 903582 |
size | 19,413 |
A Stream that only emits if the value is different.
Clone
PartialEq
with itself[dependencies]
change_stream = "0.1.0"
StreamChanged
trait and call .changed()
on an existing stream:use change_stream::StreamChanged;
use futures::{stream::iter, StreamExt};
#[tokio::main]
async fn main() {
let a = iter([1, 1, 2]);
a.changed().for_each(|a| async move {
dbg!(a); //will only emit 1 and 2
}).await;
}