News for hackers. Stuff that matters.
Re:Two Weeks of Rust by viraptor on Tuesday January 12, 2016 @07:21AM (#10886951)
Mmaped files are already available it seems (https://crates.io/crates/mmap/), although I've never tried it. You'd have to implement the interesting structures on top of that yourself however.
Re:Two Weeks of Rust by vardump on Tuesday January 12, 2016 @08:07AM (#10887145)
Relative pointers are great in memory map data structures. All pointers are relative to current offset. That way it's almost always also possible to get away with just 32-bit pointers -- you get +- 8 GB range.

A library that can do that in Rust would be great.

Re:Two Weeks of Rust by agrover on Tuesday January 12, 2016 @12:05PM (#10888604)
A signed 32 bit "offset" value gives you 2GB in each direction, not 4GB in each direction.
Re:Two Weeks of Rust by vardump on Tuesday January 12, 2016 @12:37PM (#10888851)
Only if you use byte aligned relative pointers. For data structures you don't need better than 32-bit aligned pointers. So you get +- 8GB relative offsets. It's not all that unreasonable to use 64-bit or even 128-bit alignment, for +-16 GB and +-32 GB respectively.
Re:Two Weeks of Rust by amelius on Tuesday January 12, 2016 @07:50AM (#10887066)
Hmm, it seems this library only provides the basic I/O.

The main problem is not opening the mmapped file. The problem is having a kind of pointer that allows arbitrary offsetting, and using this pointer inside standard data structures.

Re:Two Weeks of Rust by fpoling on Tuesday January 12, 2016 @09:45AM (#10887653)
Rust has typesafe arenas, when one allocates small objects from a bigger chunk of memory and typesystem ensures that small objects do not outlive the chunk. I suppose mmap files could be treated similarly when assembling a pointer from an offset stored in the mmaped file is treated as an allocation.