Quip adds expression interpolation to several quasi-quoting macros:
quote::quote!→quip!quote::quote_spanned!→quip_spanned!syn::parse_quote!→parse_quip!syn::parse_quote_spanned!→parse_quip_spanned!
Setup
Add this to your Cargo.toml:
[]
= "0.2.0"
= "1" # For `quip!` and `quip_spanned!`.
= "2" # For `parse_quip!` and `parse_quip_spanned!`.
Syntax
All Quip macros use #{...} for expression interpolation, where ... must evaluate to a type implementing quote::ToTokens. All other aspects, including repetition and hygiene, behave identically to the underlying macro.
quip!
Behind the Scenes
Quip scans tokens and transforms each expression interpolation #{...} into a variable interpolation #... by binding the expression to a temporary variable. The macro then passes the transformed tokens to the underlying quasi-quotation macro.
quip!
The code above expands to:
match