#write #syntax #macro #nested #traits #ff #chain

macro flatfish

A macro to write Fully Qualified Syntax without nesting turbofishes

1 unstable release

0.1.0 Dec 22, 2023

#1833 in Procedural macros

MIT/Apache

7KB
54 lines

Flatfish

flatfish crate flatfish documentation

Provide a ff! macro to write Fully Qualified Syntax without nesting turbofishes.

Which can be usefull in very generic code when the chain of traits and associated types can be long and verbose, or in macros generating chains of traits.

Syntax is

ff!(Type | Trait1::Item | Trait2::Item ...)

which desugars to

<... <<T as Trait1>::Item as Trait2>::Item ...>

Last item can be any associated item: type, function or constant.

Dependencies

~260–710KB
~17K SLoC