Skip to content

misc#63

Merged
declanvk merged 3 commits intomainfrom
misc
Aug 24, 2025
Merged

misc#63
declanvk merged 3 commits intomainfrom
misc

Conversation

@declanvk
Copy link
Owner

  • Rename test_common module and place behind feature flag
  • Replace bytemuck with zerocopy for conversions
  • Make InnerNode an unsafe trait

declanvk added 3 commits July 21, 2025 10:29
**Description**
Before this testing module was a hidden part of the public API, this
change makes it so that users would need to opt in.

I learned from rust-lang/cargo#2911 that
you can take a `dev-dependency` recursively with extra features
enabled, this allows the feature to be off by default and still used
in the dev dependencies.

**Testing Done**
Unit tests already exercise this code.
**Description**
We used `bytemuck` for conversion to bytes and between compatible
types, to avoid doing raw `transmute`s.

Switching to `zerocopy` because I'd like to use it for a future
commit and it felt redundant to keep `bytemuck` around.
All types that implement `InnerNode` must  be `repr(C)` and have a
`Header` as their first field. This allows other unsafe code to rely on
casting a pointer to any inner node to a pointer to a `Header`. This
commit formalizes this requirement by marking `InnerNode` as an
`unsafe trait`.

Also change `leaf_node_ptr.read()` to `leaf_node_ptr.as_ref()` to avoid
an unnecessary copy.
@declanvk declanvk merged commit 2300c1a into main Aug 24, 2025
4 checks passed
@declanvk declanvk deleted the misc branch August 24, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant