News for hackers. Stuff that matters.
Re:The struggle with Rust by pcwalton on Tuesday January 24, 2017 @11:27AM (#13472717)
Just use petgraph. It manages all of this for you.
Re:The struggle with Rust by dman on Tuesday January 24, 2017 @01:31PM (#13474084)
I work on databases and I ran into similar problems implementing index data structures. While I understand petgraph solves some/all of these problems completely - it would be great if the barrier to writing trees / graphs from scratch in Rust would be lower than it is currently.
Re:The struggle with Rust by mtanski on Tuesday January 24, 2017 @02:11PM (#13474482)
Same problem. Working on an OLAP database toolkit (tried to in Rust)... writing typical database data structures is excruciating painful in Rust.

Trees, indexes (including bitmaps), buffer allocators and even just keeping state in streaming cursors (Volcano model). Are all pain in the ass in to implement.

In fact implementing a Cursor trait for like 10 different Cursor (SrcView, Join, Project, Compute, ...) became painful because each cursor struct has it's own complex lifetime params and those lifetimes were trying to leak into the main Cursor trait.

Right now I can't do that without resolving to runtime using RefCell. In my case the plans could be entirely materialized at compile time, so not really a win.

The situation won't get better until there's some kind of abstraction over lifetimes (HKT?).