https://github.com/limpix31/ticque
https://github.com/limpix31/ticque
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/limpix31/ticque
- Owner: LIMPIX31
- Created: 2024-05-21T12:52:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T08:35:25.000Z (about 2 years ago)
- Last Synced: 2025-02-28T16:55:30.982Z (over 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# ticque
A pattern that can help request data from a data stream running in a loop
## Example
```rust
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?;
```