This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
some improvements to bounded vec API #10590
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kianenigma
added
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D5-nicetohaveaudit ⚠️
PR contains trivial changes to logic that should be properly reviewed.
labels
Jan 5, 2022
bkchr
approved these changes
Jan 5, 2022
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
TODO: maybe I can add these to |
shawntabrizi
approved these changes
Jan 5, 2022
Agree about bounded tree map, but probably we should be looking to remove weak bounded vec versus giving it more features. So i would suggest not even adding it right now until we ourselves feel major pain to need it |
added to btree map and set, but not weak bounded vec. will wait for one of you to merge or approve again, since the code changed a bit. |
bkchr
approved these changes
Jan 6, 2022
bot merge |
grishasobol
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Mar 28, 2022
* some improvements to bounded vec * revert license tweak * more tests * fix * Update frame/support/src/storage/bounded_vec.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * add the same stuff for btree map and set as well Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
ark0f
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Feb 27, 2023
* some improvements to bounded vec * revert license tweak * more tests * fix * Update frame/support/src/storage/bounded_vec.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * add the same stuff for btree map and set as well Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D5-nicetohaveaudit ⚠️
PR contains trivial changes to logic that should be properly reviewed.
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.
From my work in https://github.com/paritytech/substrate/tree/kiz-multi-block-playground and paritytech/polkadot-sdk#461, I've worked a lot with bounded vec and have found some issues with it. This is bringing some of them back to master.
About the
TryCollect
, the downside as of now is that this cannot work for something likeFilter<_, _>
. Instead, we can make a custom marker traitNonIncreasingIter
, which will mark all iterator types that cannot increase the size of an iterator (almost all of them, right?). Then we can probably support things likeFilter
as well by relying on this custom marker instead of theExactSizeIterator
.As for the equality update, I think the benefit is clear, and I don't see why we should consider two bounded vecs not equal if they have the same bound, expressed as different types.
Lastly, I am also very keen on making a
bounded_vec![]
macro as well as it is a pure PITA to construct them frequently otherwise. To the best of my knowledge that would require a proc-macro, so I have hesitated from doing it so far.