Tokio lead previews Toasty ORM – because Rust is productive for more than just systems programming

Tokio lead previews Toasty ORM – because Rust is productive for more than just systems programming

Tokio project lead Carl Lerche has introduced Toasty, an async ORM (Object Relational Mapping) library for Rust, to improve productivity when the language is used for work such as web applications.

Lerche states that while Rust is positioned as a systems-level language, for performance-critical work, it is also used for higher level projects, the reason being that “once you learn Rust, you can be very productive.”

Toasty, wrote Lerche, will fill “a gap in Rust’s ecosystem,” since the current state of Rust ORM libraries is “a big friction point.”

The Toasty ORM is in an early stage of development and “not ready for real-world usage” said Lerche. It is open source on GitHub under the MIT license.

Tokio is an asynchronous runtime for Rust that is widely used for networking applications. According to this list it is among the top 10 most popular Rust libraries with over 11 million downloads. The wide recognition for Tokio means that Toasty is also likely to get attention in the Rust community.

Currently Toasty supports just two database manages: Sqlite and AWS DynamoDB. The former is for SQL databases, the latter for NoSQL databases, and Lerche considers that the way the library handles both SQL and NoSQL is innovative. There is no attempt to abstract away the differences though, and developers will need to understand how to model a project’s schema for the target database manager. Lerche intends soon to add support for Apache Cassandra, another NoSQL option, and hopes that others will contribute implementations for others.

Use of Toasty involves creating a schema file for the required data model and then using a CLI (Command Line Interface) tool to generate the Rust code for working with that data model. The developer can then use the generated code to create and work with data stored in the target database.

Some developers prefer not to use ORMs and Lerche remarks that “many of you have strong opinions” on the subject. In the Discord channel for Toasty though, there is a generally positive reaction, with comments such as “really excited to see this off the ground. An ORM that generates Rust types from a plaintext schema file has been on my list for a while,” and “I’m just stoked this exists, been wanting this for a long time.”

On Hacker News though, opinions are divided. “I’ve used ORMs in certain projects, but iterating and optimizing them later on became untenable. I’ve learned my lesson — all my new projects forgo ORMs by default,” said one.

ORMs are popular with some though, and Toasty will be of interest to many Rust developers working on general-purpose applications.