3 ms·
I wonder if for issues 1 and 2 a small amount of unsafe code could just solve them. At least for 1 this would seem quite achievable.
by vander_elst 1y ago
I wonder if for issues 1 and 2 a small amount of unsafe code could just solve them. At least for 1 this would seem quite achievable.
- mikepurvis 1y agoI don't even think unsafe is necessary for (1), just a custom allocator, as I suggested in a sibling comment. For 2, I believe the pattern would be to make a generic version of the data structure as its own crate, with all the required unsafe stuff in there, properly tested and hidden behind a safe interface. Obviously that does require the data structure to be well defined and for you to know upfront what all the internal references and transformations are going to need to be (but honestly... it's probably good for that to be the case regardless).
- c0balt 1y agoLast I checked a custom allocator required unsafe code for pointer handling, one can hand this off to a library but the unsafe code is still there (though maybe better tested given a mature enough library).