#event-stream #wikimedia #mediawiki #events #api-bindings #event-log

eventstreams

Client for Wikimedia's EventStream recent changes feed

4 releases (2 breaking)

0.3.1 Jun 18, 2021
0.3.0 Jun 18, 2021
0.2.0 Jun 23, 2020
0.1.0 Jun 15, 2020

#9 in #wikimedia

GPL-3.0-or-later

29KB
150 lines

eventstreams

crates.io docs.rs pipeline status coverage report

The eventstreams crate provides a convenient, typed, wrapper around Wikimedia's EventStreams live recent changes feed.

License

eventstreams is (C) 2020-2021 Kunal Mehta, released under the GPLv3 or any later version, see COPYING for details.


lib.rs:

eventstreams

The eventstreams crate provides a convenient, typed, wrapper around Wikimedia's EventStreams live recent changes feed.

use eventstreams::{Event,StreamExt};

let stream = eventstreams::stream();
eventstreams::pin_mut!(stream);
while let Some(event) = stream.next().await {
   match event {
       Event::Edit(edit) => {
           println!(
               "{}: {} edited {}",
               &edit.server_name, &edit.user, &edit.title
           );
       }
       Event::Log(log) => {
           println!(
               "{}: {} performed {}/{} on {}",
               &log.server_name,
               &log.user,
               &log.log_type,
               &log.log_action,
               &log.title
           );
       }
   }
}

Dependencies

~9–12MB
~204K SLoC