4个版本
| 0.1.3 | 2024年5月22日 | 
|---|---|
| 0.1.2 | 2024年5月21日 | 
| 0.1.1 | 2024年5月21日 | 
| 0.1.0 | 2024年5月21日 | 
#493 in 异步
6KB
120 行
ticque
一种可以帮助从循环运行的数据流中请求数据的模式
示例
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?;
依赖项
~0.6–1.1MB
~23K SLoC