Crates.io | casus |
lib.rs | casus |
version | 0.1.0 |
source | src |
created_at | 2022-12-31 05:55:49.732286 |
updated_at | 2022-12-31 05:55:49.732286 |
description | A simple library containing a handful of event-based async primitives |
homepage | |
repository | https://github.com/mrvillage/casus |
max_upload_size | |
id | 748256 |
size | 13,853 |
Casus is a simple library containing a handful of useful generic async primitives. At present, it contains Event
and Waiter
primitives.
The Event primitive allows a future to await the completion of an event. Once the event is completed, all futures trying to await it will immediately return and continue until the event is reset.
use casus::Event;
let event = Event::new();
// this will block until Event::set is called elsewhere
event.wait().await;
The Waiter primitive simply waits to be woken up with it's return value.
use casus::Waiter;
let waiter = Waiter::new();
// this will block until Event::wake is called elsewhere
waiter.await;