You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was looking into this and it appears a bit more complicated than initially thought. A few thoughts on what would help enable this.
First, there should probably be some sort of "entry API" in the sense of some opaque Entry<'_, T> type that represents a spot in the vec. Essentially, as long as the index of the entry is in-bounds, the entry would be returned, but you can't actually get a reference to the underlying element until it's ready. It should have at least a "try access" method that returns Option<&T>.
Second, there should be an iterator that returns these entries in the correct order. Reading the code for iter, I know that gaps are allowed, but it appears that they're also allowed to be returned out-of-order. This would allow stuff like enumerate() to work properly without having to track indices separately.
Third, we could easily use this new iterator for Debug to display gaps based upon the "try access" method.
The text was updated successfully, but these errors were encountered:
Just to track this so it doesn't get lost.
Was looking into this and it appears a bit more complicated than initially thought. A few thoughts on what would help enable this.
First, there should probably be some sort of "entry API" in the sense of some opaque
Entry<'_, T>
type that represents a spot in the vec. Essentially, as long as the index of the entry is in-bounds, the entry would be returned, but you can't actually get a reference to the underlying element until it's ready. It should have at least a "try access" method that returnsOption<&T>
.Second, there should be an iterator that returns these entries in the correct order. Reading the code for
iter
, I know that gaps are allowed, but it appears that they're also allowed to be returned out-of-order. This would allow stuff likeenumerate()
to work properly without having to track indices separately.Third, we could easily use this new iterator for
Debug
to display gaps based upon the "try access" method.The text was updated successfully, but these errors were encountered: