Support an additional (optional) key in iddqd::IdOrdMap (“BiOrdMap”)
还没有人认领这个 Issue。
评估
调研方向
首先阅读现有的 IdOrdMap API 及其当前的索引行为。审查提议的 BiOrdMap 设计以及构造函数、索引和迭代相关的问题,然后在实现之前确定预期的 API 和性能权衡。设计达成一致,并且新 map 的行为由适当的测试覆盖,即视为完成。
由索引模型根据 Issue 内容生成。
描述
I love this crate, thank you for all the work!
Quick notice: I’m happy to help drive this feature, but my bandwidth is very limited for the next 6 weeks.
Background
IdOrdMap<K,V> today maintains exactly one sorted key. I need one primary index (sorted) and a secondary key for fast lookup, without being forced to rebuild maps or sort on the fly.
I began this on Reddit but it’s complex enough to merit an in-repo API discussion.
Options
- Only primary sorted + secondary lookup
• Simple, but if you later need to sort by the second key, you’re back to ad-hoc sorting or a separate map. - Two always-sorted keys
• Two B-trees under the hood; higher memory & insertion/removal cost. - Primary sorted + optional sorted
• Zero-cost if you don’t invoke the second sort.
• API is trickier: needs either builders/constructors or trait-gated impls.
API Questions
• Should one hard-code a .with_secondary_index() constructor, or infer “sortable” from K: Ord + Clone?
• Does one expose separate .iter_by_primary()/.iter_by_secondary() methods, or a unified .iter(Index)?
• Is it better to have separate BiOrdMap vs. a single generic type with optional indices?
Initial Proposal
Introduce a BiOrdMap<K1, K2, V> that always provides:
• Primary sorted index on K1
• Secondary unsorted lookup by K2
This stays close to the existing API, provides a playground to refine constructors, method names, and performance trade-offs, and lays groundwork for an optional‐sort variant later.
Feedback and real-world use cases welcome!
- 主要语言
- Rust
- 星标
- 411
- 派生
- 16
- 平均合并
- 21 分钟
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
oxidecomputer/iddqd 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
oxidecomputer/iddqd#249 ·
-
难度 3/5 1-2 天 新手友好度 35/100
oxidecomputer/iddqd#185 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 15/100
oxidecomputer/iddqd#44 ·
-
难度 3/5 1-2 天 新手友好度 38/100
oxidecomputer/iddqd#41 · 2 条评论 ·
-
help-wanted
难度 5/5 一周以上 新手友好度 25/100
oxidecomputer/iddqd#33 · 2 条评论 · 1 个 reaction ·
查看 oxidecomputer/iddqd 的全部 Issue
相似的 Issue
-
comp-view potential bug
难度 2/5 1-3 小时 新手友好度 80/100
ClickHouse/ClickHouse#128410 ·
维护者通常 1 天内回复
-
Save As onto the project's own .snxprj overwrites it with a schematic and the project can no longer open可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: app data-loss priority: high type: bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
lan_bot: 13 of 15 tests fail on main (minecraft:dialog entries carry data with the known pack)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭skip-release
难度 2/5 1-3 小时 新手友好度 75/100
horizon-rust/horizon#5505 ·
维护者通常 1 天内回复
-
area: cloud S3: minor
难度 2/5 1-3 小时 新手友好度 70/100
manaflow-ai/cmux#29709 · 1 条评论 ·
维护者通常 1 天内回复
-
area:mem good first issue priority:low type:docs
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复