#iteration #iterator #values #traits #macro #default #exhaustive

no-std exhaust

Trait and derive macro for working with all possible values of a type (exhaustive enumeration)

2 releases

0.1.1 Apr 10, 2023
0.1.0 Feb 15, 2022

#969 in Rust patterns

Download history 201/week @ 2023-12-10 40/week @ 2023-12-17 62/week @ 2023-12-24 31/week @ 2023-12-31 42/week @ 2024-01-07 94/week @ 2024-01-14 113/week @ 2024-01-21 21/week @ 2024-01-28 104/week @ 2024-02-04 186/week @ 2024-02-11 88/week @ 2024-02-18 183/week @ 2024-02-25 83/week @ 2024-03-03 85/week @ 2024-03-10 87/week @ 2024-03-17 127/week @ 2024-03-24

385 downloads per month
Used in 7 crates (3 directly)

MIT/Apache

39KB
738 lines

Exhaust(ive iteration for Rust)

exhaust is a Rust library which provides the Exhaust trait, which can be used to iterate over all possible values of a type that implements it. Implementations are provided for standard library types, and derive macros are available to allow easy implementation for user-defined types.

Exhaustive iteration may be useful for exhaustive testing, working with enums, and solving constraints by brute-force search.

exhaust is no_std compatible with default features disabled. The alloc and std features add implementations for the corresponding standard library crates.

Project status and stability

exhaust is currently in an early stage of development, and has been published for the sake of receiving feedback. I intend to quickly bring it to feature-completeness within its narrow scope, making it a library that can be relied upon by Rust programmers.

License

Licensed under either of

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.

Dependencies

~0.7–1.2MB
~26K SLoC