paste

A Rust proc-macro for pasting identifiers together at compile time

Library
Cargo
v1.0.15
1,090stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity0
Maintenance32
Community48
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
74/100Good
Architecture72
Code Quality78
Innovation70
Learning Curve75

paste is a small procedural macro crate from David Tolnay (dtolnay) that solves a specific gap in Rust’s macro system: built-in declarative macros can’t concatenate identifiers into a new identifier (e.g. combining Foo and Bar into FooBar) at the token level. paste provides a paste! macro block inside which special [<...>] syntax pastes together identifiers, literals, and case-converted fragments into a single new identifier usable anywhere a Rust identifier is expected — struct names, function names, module paths, and more.

It’s one of the widely-depended-upon utility crates in the Rust ecosystem (part of dtolnay’s suite of proc-macro crates alongside serde_derive-adjacent tools), commonly pulled in transitively by other macro-heavy crates that need to generate identifier names programmatically, such as deriving trait implementations across a family of similarly-named types.

What You Get

  • A paste! macro for wrapping any block of code that needs to generate new identifiers
  • [<...>] bracket syntax for concatenating identifiers, literals, and other token fragments into one identifier
  • Case-conversion modifiers (e.g. snake_case, UpperCamelCase) applicable to pasted identifier segments
  • Works inside macro_rules! macros, allowing declarative macros to generate identifier-dependent code they otherwise couldn’t
  • no_std / no_alloc compatible, since it operates purely at the token/macro level with no runtime component

Common Use Cases

  • Generating a family of similarly-named structs, functions, or trait impls from a single macro_rules! macro
  • Building derive-macro-adjacent code generation where output identifiers depend on input type names
  • Writing test-generation macros that need to produce uniquely named test functions per input case
  • Implementing builder-pattern or wrapper-type macros that need to construct new type/method names from existing ones

Under The Hood

Architecture: paste is a proc-macro crate (proc-macro = true in Cargo.toml) whose entire logic lives in src/lib.rs (454 lines) plus supporting modules segment.rs (token-segment parsing/case-conversion, 233 lines), attr.rs (attribute-position macro handling, 164 lines), and error.rs (47 lines); it operates purely on the token stream at compile time, scanning for [<...>] bracket groups and re-emitting a single concatenated identifier token in their place, with no runtime component whatsoever.

Tech Stack: Written entirely in Rust (100%) with zero non-dev dependencies; its only dev-dependencies are a local paste-test-suite crate (tests/macros) plus rustversion and trybuild for compile-fail/UI-style macro testing, and it declares rust-version 1.31 for broad compatibility including no_std/no_alloc targets.

Code Quality: The codebase is compact (~900 lines total) and uses trybuild for snapshot-style compile testing of macro expansion output, which is the standard rigorous testing approach for proc-macro crates in the Rust ecosystem; it has been stable and widely depended-upon since 2018 with 9 contributors, though it has seen no commits since October 2024, reflecting a mature, feature-complete crate rather than active churn.

API Design: The API is a single macro (paste!) with one bracket syntax ([<...>]) to learn, following dtolnay’s characteristic minimal-surface design; because it operates entirely within existing macro_rules! or function bodies, there’s no new mental model beyond understanding how the bracket syntax maps to token concatenation.

Used by 8 apps in this directory

Rust
64%
Apache 2.0

agentgateway

AI Development · Developer Tools

4,420

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
72
Dependency
Built with
Rust64%
Go24%
Updated yesterday
Rust
67%
MIT

Bun

Developer Tools

95,452

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
66
Dependency
Built with
Rust67%
C++19%
Updated today
Java
34%
Apache 2.0

Enso

Analytics · Data Engineering · Low Code Platforms

7,437

A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.

View details
70
Repo Health
90
Technical
62
Dependency
Built with
Java34%
TypeScript27%
Scala26%
Updated 1 weeks ago
Rust
87%
MIT

fabro

Developer Tools · Devops

1,516

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

View details
81
Repo Health
83
Technical
70
Dependency
Built with
Rust87%
TypeScript11%
Updated yesterday
Rust
96%
Apache 2.0

InfluxDB

Databases · Analytics

31,705

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
86
Repo Health
76
Technical
72
Dependency
Built with
Rust96%
Updated yesterday
TypeScript
76%
Other

Joplin

Note Taking

56,003

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
62
Dependency
Built with
TypeScript76%
JavaScript15%
Updated yesterday
Rust
87%
AGPL 3.0

ParadeDB

Search · Databases · Analytics

9,175

Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.

View details
88
Repo Health
87
Technical
71
Dependency
Built with
Rust87%
PLpgSQL12%
Updated today
Rust
77%
AGPL 3.0

Spacedrive

File Storage · Collaboration

38,790

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
60
Repo Health
84
Technical
65
Dependency
Built with
Rust77%
TypeScript20%
Updated 3 weeks 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

Search