4 ms·
This is basically what Cap'n Proto does, and it uses offsets instead of pointers so that way the mmapped data can be used as-is.
by lilyball 2y ago
This is basically what Cap'n Proto does, and it uses offsets instead of pointers so that way the mmapped data can be used as-is.
- amelius 2y agoGood to know, but does Rust have the machinery to make it work with standard Rust data structures?
- lilyball 2y agoWhat do you mean by "standard Rust data structures"? Like protobuf and other such formats, capnp uses code generation. The tooling for Rust is at https://github.com/capnproto/capnproto-rust https://github.com/capnproto/capnproto-rust and the generated code gives you structs that wrap borrowed data and give you accessors rather than direct field access.
- amelius 2y agoWell, it would be super convenient if you could use the standard collections like Vec, LinkedList, HashMap, etc. just like you would use them normally except now they are allocated inside an mmapped file.