#count #macro #const #compile-time #blk-count

no-std blk_count_macro

A simple macro for counting a number of comma-separated tokens at compile time

2 releases

0.1.1 Mar 20, 2023
0.1.0 Mar 15, 2023

#72 in #count

Download history 4/week @ 2024-10-31 3/week @ 2024-11-07 12/week @ 2024-12-05 263/week @ 2024-12-12 44/week @ 2024-12-19 40/week @ 2024-12-26 46/week @ 2025-01-02 48/week @ 2025-01-09 58/week @ 2025-01-16 52/week @ 2025-01-23 59/week @ 2025-01-30 63/week @ 2025-02-06 39/week @ 2025-02-13

222 downloads per month
Used in 3 crates (via tuple_split)

MIT license

3KB

A simple macro for counting a number of comma-separated tokens at compile time

Code originates from the little book of rust macros by DanielKeep. I thought i'd add this as a crate to crates.io so it can easily be imported to any project if needed. No std required. I find it very useful for counting the number of elements when implementing traits for tuples within a macro.

Original macro code: https://danielkeep.github.io/tlborm/book/blk-counting.html

No runtime deps