m(breaking): Simplify internal storage and lookup mechanisms #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the current
Vec
andnext_id
-based storage strategy with theSlab
type.Slab
is similar to the current storage strategy, except that the key corresponds directly to the index in the underlyingVec
. This means that the lookup process is anO(1)
process as opposed to anO(n)
process.The goal is to replace this bit of self-referencing code in
cosmic-text
so that one can gain access to the underlying&mut Database
.The only wrinkle that that
Slab<T>
doesn't directly correspond to an&[T]
, so thefaces()
function has to be animpl Iterator<&FaceInfo>
instead of an&[FaceInfo]
. This is a breaking change.