awaitable-bool

Crates.ioawaitable-bool
lib.rsawaitable-bool
version0.1.2
sourcesrc
created_at2023-09-03 20:33:41.361218
updated_at2023-09-20 17:51:44.459826
descriptionA Tokio-powered awaitable bool (analogous to a flag and highly inspired by Python's `asyncio.Event`, but can be waited for to become 'false' too)
homepage
repositoryhttps://github.com/babichjacob/awaitable-bool
max_upload_size
id962438
size23,374
J (babichjacob)

documentation

README

🎚️ Awaitable Bool

This Rust library is a bool that can be waited to be set to true or set to false.

💻 Installation

This crate is published to crates.io as awaitable-bool, so you can do

cargo add awaitable-bool

to add it to your project's dependencies.

🛠 Usage

You probably don't want to use this if you aren't me; I'm not familiar enough with atomics (which is how AwaitableBool is implemented) to know the correctness of the code!

😵 Help! I have a question

Create an issue and I'll try to help.

😡 Fix! There is something that needs improvement

Create an issue or pull request and I'll try to fix.

📄 License

Licensed under either of:

at your option.

🙏 Attribution

@devalain's future-bool is an existing Rust crate that already works very closely to this.

The idea is highly inspired by Python's asyncio.Event, but an AwaitableBool can be waited for to become 'clear' too (not just 'set').

This library is implemented with Tokio's Notify synchronization tool.

I also developed async-gate right before making awaitable-bool. That breaks down changing the value of the bool and waiting for value changes into two different types (Lever and Gate respectively). It is more complex.

This README was generated with ❤️ by readme-md-generator

Commit count: 5

cargo fmt