There's more...

A slab is backed by a Vec<Entry>. You might remember the Entry from our recipe about the HashMap earlier. It is the same as an Option, with the difference that its variants are not called Some(...) and None, but Occupied(...) and Vacant. This means that, in a nutshell, a slab is implemented as a vector with holes in it:

Additionally, in order to guarantee fast occupation of vacant spots, the slab keeps a linked list of all vacant entries.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.211.92