google / google/zerocopy

Implement `Debug` (and maybe other traits that take `&(mut) self`) for `Unalign<T>` where `T: !Unaligned`

Open
#207 0 comments 0 reactions 0 assignees View on GitHub
compatibility-nonbreaking
Dominant language
Rust
Stars
2.6k
Forks
179
Avg merge
1d 19h
Merged PRs (30d)
29

Description

Use the technique described in https://github.com/google/zerocopy/issues/206, and maybe build on it if we add those methods.

One thing worth considering is whether it's acceptable to introduce the cost of copying `2 * size_of::()` bytes to trait impls that, for wrapper types, are supposed to just be passthroughs. Alternatively, we could just emit a simpler `Debug` impl that just prints the type's name but not its contents when `T: !Unaligned`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.