Fork of https://github.com/ashleygwilliams/changes-stream-rust / https://crates.io/crates/changes-stream.
An implementation of changes-stream
in Rust.
This code reads in a readable stream from an endpoint, parses each line and returns CouchDB changes events as defined in src/event.rs.
in your Cargo.toml
:
toml
[dependencies]
changes-stream2 = "0.2"
from examples/follower.rs:
```rust use changesstream2::{ChangesStream, Event}; use futuresutil::stream::StreamExt;
async fn main() { let url = "https://replicate.npmjs.com/changes".tostring(); let mut changes = ChangesStream::new(url).await.unwrap(); while let Some(event) = changes.next().await { match event { Ok(Event::Change(change)) => println!("Change ({}): {}", change.seq, change.id), Ok(Event::Finished(finished)) => println!("Finished: {}", finished.last_seq), Err(err) => println!("Error: {:?}", err), } } } ```