3 ms·
In languages like C it is quite common. In languages like Rust where there is a greater power of abstraction, it is less common as there exist versions of struc
by rkangel 10y ago
In languages like C it is quite common. In languages like Rust where there is a greater power of abstraction, it is less common as there exist versions of structures that wouldn't implementable in a re-usable way in C. Think of some examples you've had to implement in the past - you'll likely find implementations either in the stdlib or in cargo.
Yes, you will on occasion need to implement your own datastructure to meet a particular need. If you do that you're going to have to sit down and think about it, work out the guarantees, ensure that it doesn't leak etc.. All the things you'd have to do in C, but you have to do it rarely.
There are some intermediate libraries (things like 'Cell') that allow for writing structures that wouldn't otherwise be possible.