Rust ORM comparison
Rent vs Diesel
Diesel is the longest-standing Rust ORM. It infers a schema.rs from an existing database, derives model types, and offers a type-checked query DSL. Its core is synchronous, with async support through a separate crate.
Rent inverts the direction: the RSL schema is the source and the database is derived from it. The generated client is async on Tokio, migrations are planned from the schema diff rather than written by hand, and policies, tenancy, and PostgreSQL extension packages are part of the generated surface.
Side by side
| Aspect | Rent (Rust) | Diesel (Rust) |
|---|---|---|
| Schema source | One central RSL document is the source of truth. The Rust client and the database catalog are both derived from it. | schema.rs is generated from the database by diesel print-schema. |
| Client | Async, generated per model, with fluent builders and typed relationships. | Synchronous query DSL with derives; async through diesel-async. |
| Migrations | Rent diffs the RSL schema against the live catalog, classifies every operation as safe, review, or destructive, writes append-only SQL, and seals it with checksums in rent.sum. | Hand-written up and down SQL files run by diesel migration. |
| Authorization | Row policies, tenant scoping, hooks, and interceptors are part of the generated client and apply to reads, writes, and relationship endpoints. | None built in. |
| PostgreSQL extensions | Typed packages for pgvector, PostGIS, pgmq, pg_cron, pg_net, TimescaleDB, pg_search, pg_trgm, citext, pgcrypto, uuid-ossp, pg_jsonschema, pg_partman, and pgAudit, declared in the schema and checked before migration. | Extensions through custom SQL types and functions. |
| Databases | PostgreSQL first, with MySQL, MariaDB, and SQLite on the same generated client. | PostgreSQL, MySQL, and SQLite. |
Choose Rent when
- You want an async client on Tokio without an adapter crate.
- You want the schema, not the database, to be the reviewed source of truth.
- You need policies, tenancy, or typed PostgreSQL extensions.
Choose Diesel when
- You have a synchronous application or an existing Diesel codebase.
- You want a DSL that mirrors SQL clause by clause.