{"repo":"dtolnay/quote","free":true,"listed":false,"github":"https://github.com/dtolnay/quote","clone":"git clone https://github.com/dtolnay/quote.git","description":"Rust quasi-quoting","language":"Rust","stars":1575,"topics":["syn","proc-macro","rust"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"Rust Quasi-Quoting ================== This crate provides the [ quote! ] macro for turning Rust syntax tree data structures into tokens of source code. [ quote! ]: https://docs.rs/quote/1.0/quote/macro.quote.html Procedural macros in Rust receive a stream of tokens as input, execute arbitrary Rust code to determine how to manipulate those tokens, and produce a stream of tokens to hand back to the compiler to compile into the caller's crate. Quasi-quoting is a solution to one piece of that &mdash; producing tokens to return to the compiler. 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. Release notes Syntax The quote crate provides a [ quote! ] macro within which you can write Rust code that gets packaged into a [ TokenStream ] and can be treated as data. You should think of TokenStream as representing a fragment of Rust source code. [ TokenStream ]: https://docs.rs/proc-macro2/1.0/proc macro2/stru","default_branch":null,"files":null,"tree":[],"storefront":"/r/dtolnay","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dtolnay/quote/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}