As I continue playing with Rust I was looking for a sentinel deque/list and could not find one. So I decided to try and implement it myself. Coming from Java I thought it’s going to be an easy task ha ha not so much but eventually I think I succeeded.
Again it’s based on raw pointers, but I believe that the simplicity of the code justifies the unsafety of the raw pointers.
If some one finds it useful -> I am happy Here is the repo: https://github.com/atsiporu/sentinel_list
The idea is once you push element on to the list you get a handle back. With this handle you can query the element or you can unlink it from the list.
That’s really it.
Because it’s sentinel based I don’t need to do null checks, which is not that expensive but still.
List lacks iterator implementations which I am going to do next, for now its a deque.
Any comments or critique are welcome. If you think there is a better way please let me know.