Interacting with Databases in Rust

In this chapter, we'll discuss on why databases are essential to modern applications. We'll cover a few crates that are available in the Rust ecosystem, which allows one to interact with databases. We'll then continue with our linksnap API server that we developed in the previous chapter and integrate database support into it through a convenient library. This will allow us to persist new bookmarks that are sent to our API.

In this chapter, we will cover the following topics:

  • SQLite integration using rusqlite
  • Interacting with PostgreSQL with Rust
  • Database connection pooling
  • Object-relational mapping using the diesel crate
  • Integrating diesel with the linksnap API server

Get Mastering Rust - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.