google / google/zerocopy

Make the inner type wrapped in `Unalign` public

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

Description

This is not exactly a customer request since I'm not using this crate currently, but I was looking on the docs and I wondered why won't you make the inner field of [`Unalign`](https://docs.rs/zerocopy/latest/zerocopy/struct.Unalign.html) public?

Usually when prefer to make newtype's field private, but in this case making it public has a big advantage: we cannot make a reference to it and so we cannot expose it in a non-copying way, but if it is public the compiler allows reads/writes to fields of it as long as we never take a reference and only read/write directly. This can make working with this type more comfortable.

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.