this post was submitted on 29 Jun 2022
15 points (89.5% liked)

Rust Programming

8168 readers
3 users here now

founded 5 years ago
MODERATORS
 

Hello all, I'm learning Rust after years of programming mainly in C/C++.

Python has a very neat shelve library: https://docs.python.org/3/library/shelve.html It's basically a dict (hash table), but is located on disk instead of memory. It's great for easy persistence and also for working with massive objects that won't fit into memory.

Is there anything similar for Rust? I could not find any, but I'm still learning Rust and could have missed it.

top 2 comments
sorted by: hot top controversial new old
[โ€“] nutomic@lemmy.ml 4 points 2 years ago
[โ€“] nous@programming.dev 1 points 1 year ago

You are probably looking for a database (possibly an embedded database) that supports a key/value or document store. Using those keywords will let you find things similar to what you are looking for.

But some you might want to look at are:

  1. Surrealdb which will give you a document, relational or graph storage/querying and it also supports embedding in rust application in addition to running as a stand alone service (with multinode support). This is the most flexible option in how you run it and what you can do with this.
  2. Bonsaidb is another document database that can run stand-alone and I think can be embedded as well.
  3. Sled which a simpler embedded key/value store.
  4. Persy which is a embedded key/value storage engine for rust.

Then there is always redis which is the standard key/value store or really data structures as a service solution for most languages and sees a lot of production use. This is stand-alone service only though and cannot be embedded in a rust binary.