kyren / hashlink

An updated version of linked-hash-map and friends
Apache License 2.0
98 stars 18 forks source link

feat: add `CursorMut` #25

Closed olebedev closed 6 months ago

olebedev commented 8 months ago

Motivation

Add a feature that enables insert elements in the middle of the underlying linked-list. Initial discussion is in https://github.com/kyren/hashlink/issues/23.

Following further reflection since our initial discussion, I've implemented the CursorMut API as outlined in my previous comment. This pull request is intended to supersede #24, which I suggest we close in favor of this updated approach.

In this PR

The difference to the Cursor API from the RFC:

I'm open to discussions about the API design and its implementation. I would appreciate your thoughts on the matter.

Kind regards, Oleg

kyren commented 8 months ago

Hey, I just got back from a trip so this is good timing, I hadn't even had a chance to look at #24 yet. I promise I'll review this the next few days, but from a quick glance, I'm definitely happier with this than I am with something like insert_before. Copying (mostly) the Cursor API from the stdlib is a good move.

It might be nice to have a read-only Cursor as well but that's for sure not required for an initial PR.

kyren commented 7 months ago

Hi, I'm very sorry I waited so long on reviewing this, I just got through with a huge cross-country move and I was completely out of commission for more than a month while I moved from Florida to Colorado.

olebedev commented 7 months ago

Hi @kyren, I understand you've been busy with your move. No worries at all. Please review the PR when the dust settles and you have a moment.

kyren commented 6 months ago

This looks very good, thanks for being patient will all of my requests!

Just a few minor nits and I think it can be merged.

kyren commented 6 months ago

Looks good now, thank you!