Same in-ram / on-disk format for basic containers :: how?

  1. Timestamp: https://youtu.be/qr9GTTST_Dk?t=499

  2. You don't have to listen to the talk; just read that one slide. This is the GitHub - citybound/citybound: A work-in-progress, open-source, multi-player city simulation game. dev talking about on-disk persistence, and how he's using a technique where data has the same on-disk/in-memory format.

  3. I understand that in theory you do this by allocating a contiguous block of memory and replacing all ptrs with offsets. Sure.

  4. In practice, how do you do this in a type-safe way that minimizes usage of unsafe ?

Isn't this what rkyv does for deserialisation for example?

1 Like

I have now gone from $N$ things I do not understand to $N+1$ things I do not understand. :slight_smile:

rkyv is a crate you could look at to facilitate zero-copy deserialization, which sounds like what you are looking for.