Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make Zeroizing transparent for cheap conversions #761

Merged
merged 1 commit into from Apr 20, 2022

Conversation

npmccallum
Copy link
Contributor

Sometimes libraries want to be generic across types like Vec<u8> and
Box<[u8]>. Therefore, they use bounds like T: AsRef<[u8]>. The
Zeroizing<Vec<u8>> type should be transparently equivalent to
Vec<u8> in this regard. This allows Zeroizing to be used with all
such bounds.

Signed-off-by: Nathaniel McCallum nathaniel@profian.com

zeroize/src/lib.rs Outdated Show resolved Hide resolved
Sometimes libraries want to be generic across types like `Vec<u8>` and
`Box<[u8]>`. Therefore, they use bounds like `T: AsRef<[u8]>`. The
`Zeroizing<Vec<u8>>` type should be transparently equivalent to
`Vec<u8>` in this regard. This allows `Zeroizing` to be used with all
such bounds.

Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
@tarcieri
Copy link
Member

Thank you!

@tarcieri tarcieri mentioned this pull request May 1, 2022
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.

None yet

2 participants