[][src]Crate squote

This crate provides the quote! macro for turning Rust syntax tree data structures into tokens of source code.

The idea of quasi-quoting is that we write code that we treat as data. Within the quote! macro, we can write what looks like code to our text editor or IDE. We get all the benefits of the editor's brace matching, syntax highlighting, indentation, and maybe autocompletion. But rather than compiling that as code into the current crate, we can treat it as data, pass it around, mutate it, and eventually hand it back to the compiler as tokens to compile into the macro caller's crate.

This crate is motivated by the procedural macro use case, but is a general-purpose Rust quasi-quoting library and is not specific to procedural macros.

[dependencies]
squote = "1.0"

Macros

format_ident

Formatting macro for constructing Idents.

quote

The whole point.

Structs

Ident

An identifier

Literal

A literal of some sort

TokenStream

A stream of tokens

Enums

Delimiter

A delimiter around a block of code

Traits

ToTokens

Types that can be interpolated inside a quote! invocation.