Conversation
The patricia tree containers are keyed by `K: Into<BitVec>`, and their iterators want `K: From<&BitVec>`. `BitVec` lives in a private module that `datatype` never re-exports, so no crate outside this one can write either impl: the bounds are satisfiable only by the integer types implemented here, and a caller keying on a newtype of its own has to fall back to `HashMapAbstractEnvironment` and give up the structural sharing that is the reason to reach for a patricia tree. Re-export it, the way every other module in `datatype` is. Nothing else in `bitvec` is public, so this exports exactly the one type. Add `to_int`, the counterpart of `from_int_with_len`, without which `From<&BitVec>` can only be written a bit at a time while the conversions here reach for the private `bits` field; they now go through it instead. Add `is_empty`, which clippy asks for once the type is public. Test plan: `cargo test` -- `foreign_key_test.rs` declares a key type the way a user of the library has to and exercises it against the map, the set and the environment. Note that `main` does not build: `a30d887` calls `update_node_by_key` with an `op` taking its node by value, which `b033084` had changed to take it by reference. This branch is based on `main` and was verified on `b033084`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HtCuENeDjeB74FUzn97FL
arthaud
force-pushed
the
export-bitvec
branch
from
September 13, 2026 16:47
32f2393 to
6cbe08f
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The patricia tree containers are keyed by
K: Into<BitVec>, and their iterators wantK: From<&BitVec>.BitVeclives in a private module thatdatatypenever re-exports, so no crate outside this one can write either impl: the bounds are satisfiable only by the integer types implemented here, and a caller keying on a newtype of its own has to fall back toHashMapAbstractEnvironmentand give up the structural sharing that is the reason to reach for a patricia tree.Re-export it, the way every other module in
datatypeis. Nothing else inbitvecis public, so this exports exactly the one type. Addto_int, the counterpart offrom_int_with_len, without whichFrom<&BitVec>can only be written a bit at a time while the conversions here reach for the privatebitsfield; they now go through it instead. Addis_empty, which clippy asks for once the type is public.Test plan:
cargo test--foreign_key_test.rsdeclares a key type the way a user of the library has to and exercises it against the map, the set and the environment. Note thatmaindoes not build:a30d887callsupdate_node_by_keywith anoptaking its node by value, whichb033084had changed to take it by reference. This branch is based onmainand was verified onb033084.