4 releases

0.1.3 May 22, 2024
0.1.2 May 21, 2024
0.1.1 May 21, 2024
0.1.0 May 21, 2024

#492 in Asynchronous

Download history 5/week @ 2024-07-30 1/week @ 2024-10-01

95 downloads per month

Apache-2.0 OR MIT

6KB
120 lines

ticque

A pattern that can help request data from a data stream running in a loop

Example

use ticque::{Vendor, Customer};

let vendor = Vendor::new();
let consumer = vendor.consumer();

tokio::spawn(async move {
  let camera_stream = ...;

  loop {
    let frame = camera_stream.next().await?;

    if vendor.has_waiters() {
      let rgb_image = frame_to_rgb(frame)?;
      vendor.send(rgb_image);
    }
  }
});

let current_rgb_image = consumer.request().await?;

Dependencies

~0.6–1.1MB
~23K SLoC