←back to thread

611 points LorenDB | 2 comments | | HN request time: 0.001s | source
Show context
atemerev ◴[] No.43908259[source]
Right. I attempted using Rust for trading-related code as well. However, I failed to write a dynamically linked always sorted order book where you can splice orders in the middle. It is just too dynamic for Rust. Borrow checker killed me.

And don't get me started on dynamic graphs.

I would happily use Rust over C++ if it had all other improvements but similar memory management. I am completely unproductive with Rust model.

replies(4): >>43908277 #>>43908709 #>>43909131 #>>43909428 #
sunshowers ◴[] No.43908277[source]
I apologize for the naive question, but that sounds like a heap?
replies(2): >>43908888 #>>43910095 #
1. atemerev ◴[] No.43910095[source]
We have to do arbitrary insertions/deletions from the middle, many of them. I think it is more like BTreeMap, but we need either sorting direction or rev(), and there were some problems with both approaches I tried to solve, but eventually gave up.
replies(1): >>43910318 #
2. sunshowers ◴[] No.43910318[source]
I see! The big issue I've run into with BTreeMap is that you can't provide an external comparator. If comparisons only require data that the keys already have, then the Reverse wrapper [1] has worked well for me.

[1] https://doc.rust-lang.org/std/cmp/struct.Reverse.html