CosmWasm / CosmWasm/cw-storage-plus

Improve trait bounds over iterators

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
51
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Currently there's a mess of trait bounds over the different containers. Raw iterators don't need `KeyDeserialize`, by example, and they usually have that restriction.

Do a full analysis of the required trait bounds for raw and typed iterators, for all the iterable containers:

- `Map`.
- `SnapshotMap`.
- `IndexedMap`.
- `IndexedSnapshotMap`.

Extend that to the indexes:

- `UniqueIndex`.
- `MultiIndex`.

Analyse also the trait bounds over all the public methods of these containers, so that they don't list extra / unneeded bounds. `key()` by example, requires `PrimaryKey` but not `KeyDeserializable`.

Also, the `Bounder` trait bound is optional. It can be imported through an `use` clause when needed, but don't need to be listed as a bound over the containers' methods (see CosmWasm/cw-plus#692).

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the iterator and public-method trait bounds across Map, SnapshotMap, IndexedMap, IndexedSnapshotMap, UniqueIndex, and MultiIndex. Compare raw and typed iterator requirements, including KeyDeserialize, PrimaryKey, and Bounder, and finish when each method lists only the bounds it needs without breaking valid container or index usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.