跪拜 Guibai
← All articles
Rust

Seven Rust Crates That Replace Homegrown Infrastructure

By RockByte ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

These crates let a small Rust team replace what used to be separate services: a search engine, a data processing pipeline, and a plugin sandbox, all inside a single binary. That changes the cost of shipping tools with real product capabilities.

Summary

Seven Rust crates now handle the jobs that used to force teams into assembling separate services or hand-written utilities. Tokio schedules async tasks and I/O events; Serde separates data models from serialization formats; Ratatui gives terminal tools a frame-based rendering model; GPUI provides a GPU-accelerated native UI framework from the Zed editor; Polars embeds a columnar query engine with lazy execution; Tantivy brings Lucene-style full-text search in-process; Wasmtime runs WebAssembly plugins under explicit capability grants.

The crates fall into three tiers. Tokio and Serde are base libraries that change how most code is written. Ratatui and GPUI are frameworks that shape application structure. Polars, Tantivy, and Wasmtime are embeddable engines that add a major capability while leaving operational responsibility with you. The author's test for adoption: use a crate only when it replaces something you would otherwise have to design, test, and run yourself. GPUI is the outlier; it's not yet 1.0, tied to Zed's roadmap, and needs evaluation for accessibility, OS coverage, and ecosystem maturity before a team bets on it.

Takeaways
— Tokio is an async runtime that schedules tasks and handles I/O events, using work-stealing for multithreading.
— Serde separates a Rust struct's data model from the wire format, letting the same type go to JSON, TOML, YAML, MessagePack, and binary formats.
— Ratatui offers a frame-based rendering model for terminal apps, with the app managing state and event loops.
— GPUI is a GPU-accelerated UI framework from Zed; it's pre-1.0 and closely tied to Zed's development.
— Polars supports lazy execution and query planning, allowing the engine to push down filters and column selection.
— Tantivy embeds full-text search similar to Lucene, requiring the host to manage schema, indexing, and replication.
— Wasmtime runs WebAssembly modules with a capability-based permission model; the host decides which functions, files, and resources the plugin can access.
— The author's rule: adopt a crate only when it replaces infrastructure you would otherwise build yourself.
— The categories are base libraries (Tokio, Serde), frameworks (Ratatui, GPUI), and embeddable engines (Polars, Tantivy, Wasmtime).
Conclusions

The distinction between "useful" and "should use" is a practical heuristic for keeping dependency trees purposeful, especially in a language where pulling a crate is cheap.

The maturity gap between GPUI and the other six crates shows that a promising framework can still be a risky pick when the ecosystem around it hasn't settled.

The article treats each crate as replacing a specific hand-rolled system, suggesting that the Rust ecosystem's value is moving from primitives to complete engineering solutions.

Concepts & terms
async runtime
A library that schedules and drives async tasks, providing the executor and event loop that Rust's async/await syntax relies on.
lazy execution
A query execution mode where the program builds a query plan and executes it later, allowing the engine to optimize operations like filter pushdown.
capability model
A security model where the host explicitly grants a WebAssembly module access to specific resources instead of giving it full process privileges.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗