Expand description
§Quasi-Quote
qq is an alternative to quote,
providing native proc_macro support and a different escaping syntax (see qq!).
It supports Rust 1.56 and above.
§Crate features
proc-macro(enabled by default): Enables support for theproc_macrocrate. Functions behind this feature gate may panic if called from outside of a procedural macro.proc-macro2: Enables support for theproc-macro2crate.preserve-proc-macro: Only has an effect when bothproc-macroandproc-macro2features are enabled. Changes some internals from only usingproc-macro2to using enums of it and regularproc-macro.
This could be redundant, sinceproc-macro2types are usually already enums ofproc_macrotypes and fallback types, butproc-macro2is up to some weird shenanigans like rustc-version-dependent API, nightly detection, and semver exemption percfg, so this feature offers the option to trade a small bit of efficiency for the guarantee that code usingproc_macrotypes will always go throughproc_macroand never switch over toproc-macro2because some other crate in the dependency tree depended on this crate and enabled theproc-macro2feature.rust-1-79: ImplementsQuotefor&CStrto create a c-string literal. (Note that you can still create a c-string literal in earlier Rust versions usingLiteral::from_str; ALiteralalways implementsQuote.)
Note that either proc-macro or proc-macro2 has to be enabled, otherwise this crate is useless (and doesn’t compile).
Re-exports§
pub extern crate proc_macro;
Re-exports§
pub use proc_macro2;proc-macro2
Macros§
- Convert written code to a type that implements
Quoteby emitting the tokens that make up the written code.
Structs§
- Quote
Builder - Helper type to make writing out deeply nested tuples for
impl Quoteeasier. - Quote
Iter Quoteadapter for iterators.- With
Span TokenAccumulatorthat attaches a given span to all accumulated tokens.
Enums§
- Quote
Either Quoteadapter formatchoutput.
Traits§
- Quote
- Main trait of this crate.
- Quote
Ext - Convenience methods for
Quote. - Token
Accumulator - Something that can accumulate tokens.
Type Aliases§
- Group
- Wrapper for
proc_macro::Group,proc_macro2::Group, or a lazily quoted value. - Ident
- Wrapper for
proc_macro::Ident,proc_macro2::Ident, or a lazily quoted value. - Literal
- Wrapper for
proc_macro::Literal,proc_macro2::Literal, or a lazily quoted value. - Punct
- Wrapper for
proc_macro::Punct,proc_macro2::Punct, or a lazily quoted value.