quote

The quasi-quoting library that turns Rust syntax into token streams for procedural macros.

Library
Cargo
v1.0.47
1,579 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 48
Maintenance 60
Community 52
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
91 /100 Excellent
Architecture 90
Code Quality 92
Innovation 93
Learning Curve 75

Quote provides the quote! macro for turning Rust syntax-tree data structures into tokens of source code. It is the quasi-quoting half of the Rust procedural-macro toolchain: you write code that looks like Rust, treat it as data, interpolate runtime values into it with #var, and hand the resulting TokenStream back to the compiler.

Authored by David Tolnay and built on proc-macro2, quote is a foundational crate downloaded over a billion times and depended on by nearly every derive macro and code generator in the Rust ecosystem. Though motivated by procedural macros, it is a general-purpose quasi-quoting library usable in build scripts and ordinary code as well.

What You Get

  • The quote! and quote_spanned! macros for building token streams from template code
  • The ToTokens trait implemented for most primitives and syn types, so any value can be interpolated with #var
  • Repetition syntax #(...)* and #(...),* for iterating collections directly inside a template
  • The format_ident! macro for correctly constructing new identifiers from runtime values
  • A no_std-compatible, single-dependency build that works in tests, build scripts, and non-macro code

Common Use Cases

  • Generating the output token stream of a derive or attribute procedural macro
  • Emitting Rust source from a build.rs code generator, optionally formatted through prettyplease
  • Constructing impl blocks, struct definitions, and method calls programmatically from parsed input
  • Building up a final token stream by combining smaller quoted fragments from helper functions

Under The Hood

Architecture

The crate centers on src/lib.rs, a large declarative-macro engine that expands quote!/quote_spanned! by recursively walking the template token-by-token and lowering #var interpolations and #(...)* repetitions into imperative append calls. Those calls target the runtime layer in src/runtime.rs, which supplies helpers like push_* token constructors, RepInterp, and ext::RepIteratorExt to drive repetition. The public trait surface lives in src/to_tokens.rs (ToTokens), src/ext.rs (the sealed TokenStreamExt with append/append_all), src/format.rs (format_ident!), src/ident_fragment.rs (IdentFragment), and src/spanned.rs, with everything ultimately emitting proc_macro2 token types.

Tech Stack

Written in Rust (edition 2021, MSRV 1.71) with a single runtime dependency on proc-macro2 (default-features off, no_std via alloc). A proc-macro cargo feature toggles the dynamic dependency on libproc_macro so the crate can be used outside macro contexts. Dev dependencies are trybuild and rustversion for compile-fail testing; benchmarks live in a separate workspace member.

Code Quality

Quality is exemplary: tests/test.rs holds ~575 lines of behavioral tests, tests/ui/ contains trybuild compile-fail fixtures driven by tests/compiletest.rs, and benches/ tracks expansion performance. The code is idiomatic dtolnay — sealed traits to prevent unsound external impls, careful span propagation for hygiene, and thorough rustdoc with runnable examples on every public item.

API Design

The developer experience is a benchmark for the ecosystem. A single quote! { ... } invocation reads like the code it produces, #var interpolation and #(...),* repetition mirror macro_rules! intuitions, and format_ident! removes the footguns of manual identifier construction. Getting started requires almost no boilerplate, and the extensive documentation covers hygiene, spans, and non-macro code generation.

Used by 30 apps in this directory

Rust
65%
Apache 2.0

agentgateway

AI Development · Developer Tools · Mcp

5,071

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
88
Repo Health
82
Technical
69
Dependency
Built with
Rust 65%
Go 23%
Updated 5 days ago
Dart
74%
AGPL 3.0

AppFlowy

AI Assistants · Collaboration · Productivity

76,967

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
67
Dependency
Built with
Dart 74%
Rust 24%
Updated 1 weeks ago
Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
Rust
67%
MIT

Bun

Developer Tools

96,068

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
64
Dependency
Built with
Rust 67%
C++ 19%
TypeScript 10%
Updated 5 days ago
Rust
54%
Other

Cap

Team Chat · Video Conferencing

22,884

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 54%
TypeScript 42%
Updated 4 days ago
Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
Rust
95%
Other

Databend

Data Engineering · Databases

9,452

Open-source enterprise data warehouse unifying analytics, vector search, full-text search, and AI agent orchestration in a single Rust-built engine on S3.

View details
93
Repo Health
84
Technical
77
Dependency
Built with
Rust 95%
Updated 4 days ago
Rust
67%
Other

DefGuard

Authentication · Networking · Security

2,849

Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.

View details
84
Repo Health
82
Technical
72
Dependency
Built with
Rust 67%
TypeScript 31%
Updated 1 weeks ago
Rust
80%
MIT

fabro

Developer Tools · Devops

1,658

Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.

View details
82
Repo Health
83
Technical
67
Dependency
Built with
Rust 80%
TypeScript 15%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers