floop is a more convenient and less error-prone replacement for loop { select! { ... }} with support for any runtime, no-std, and no-alloc.
floop is not a replacement for select without a loop and does not need to be put inside a loop (it generates its own loop).
unlike loop select, cancel-safety doesn't matter, as futures are not cancelled when another arm finishes
(loop select requires cancel-safe futures or work arounds to make futures cancel safe, floop doesn't,
the worst part is that loop select doesn't warn you when a future is not cancel safe, it just silently causes unspecified behaviour),
futures also don't need to be fused, unpin, or have some other obscure property.
see the docs (TODO: add doc link) for details.
addtional features:
- if conditions on arms,
- if else conditions on arms,
- compile-time footgun detection (doesn't cover all footguns, see the docs for details)
- rust-analyzer friendly on errors
break, you can break individual arms usingbreak- code, comments, the REAMDE, etc. where written by me, a human, no LLM was used.
(technically all search engines use LLMs now, making it very difficult to avoid LLMs entirely, but i try to avoid LLM-generated results)
Credits
max: the compiler-manipulation used to detect footguns is mostly copied from this blog post.
unsynn (crate): unsynn is the parser library used to implement the macro, it's great.
License
Licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
additionally i do not accept LLM-generated code, please do not submit pull requests containing any amount of LLM-generated code, even if it's only a single line.
(using LLMs for translating between another language and english is ok if explicitely stated and the LLM did not modify any code)