TCFSMFTTTCS 0.1.2

Unsafe, yet fast finite state machine for counting :ty TokenTree clusters in any :ty TokenTree cluster sequence. It works for proc_macro2::TokenStreams too
Documentation

Dare not to pronounce it

Finite State Machine for counting :ty TokenTree clusters in :ty TokenStreams and other :ty TokenTree cluster sequences

Definitions, Signs, and Properties

Being maximally fast is the the main goal of this crate. For that reason, mathematical reasoning about its performance in conjunction with repeatable benchmarks to prove or refute the theory will be presented. Definitions, signs, and properties of the crate will reveal its mathematical foundations.

Definitions

The terminology widely used in the crate

TokenTree sequence

TokenTree sequence, as opposed to the TokenStream, is a concept and not a particular implementation of a sequence of TokenTrees

:ty TokenTree cluster

:ty TokenTree cluster is a TokenTree sequence that matches :ty designator

:ty TokenTree cluster sequence

:ty TokenTree cluster sequence is a sequence of :ty TokenTree clusters

Declarative macro pattern

Declarative macro pattern is a pattern for matching TokenTrees in declarative macros /"macros by example"/macro_rules!/plain macros. For example, $($type:ty),* pattern. Learn more about declarative macro patterns and designators.

:ty TokenTree sequence

:ty TokenTree sequence

:ty TokenStream

:ty TokenStream is a TokenStream that matches $($type:ty),* declarative macro pattern

Signs

Features of particular entities that allow to claim that they are in fact also have the propety of being something else. For example, if the left operand of a summation is 1 and the right operand of the summation is 1, we can guarantee that the result of the operation is 2.

Signs of :ty TokenTree clusters` boundaries in a :ty TokenTree sequence

In a non-empty :ty TokenTree sequence, the first :ty TokenTree cluster starts at index 0 and each consequent occurence of a ":" TokenTree::Punct followed by a "ty" TokenTree::Ident marks the end of the current :ty TokenTree cluster and, if there are more TokenTrees, is immediately followed by the beginning of the next :ty TokenTree cluster. In an empty :ty TokenTree sequence, there are no :ty TokenTree clusters.

Properties

None