count_tts 0.1.0

A simple macro for counting tokens.
Documentation

Count Token Trees Macro for Rust

crates.io Docs License

Description

A simple and optimized macro for counting tokens.

The macro uses bitshift operators and a logarithmic parsing algorithm to minimize output length and parsing recursion.

use count_tts::count_tts;

assert_eq!(
    // expands to (1 << 1 | 1) << 1 | 1
    count_tts!(1 2 3 4 5 6 7),
    7
);