refactor(masking): PII improvements (#77)

This commit is contained in:
kos-for-juspay
2022-12-13 08:50:21 +01:00
committed by GitHub
parent b3fefeb2aa
commit 124048ce75
16 changed files with 188 additions and 162 deletions

View File

@ -14,13 +14,13 @@ use super::{PeekInterface, ZeroizableSecret};
/// Because of the nature of how the `BytesMut` type works, it needs some special
/// care in order to have a proper zeroizing drop handler.
#[derive(Clone)]
#[cfg_attr(docsrs, doc(cfg(feature = "bytes")))]
#[cfg_attr(docsrs, cfg(feature = "bytes"))]
pub struct SecretBytesMut(BytesMut);
impl SecretBytesMut {
/// Wrap bytes in `SecretBytesMut`
pub fn new(bytes: impl Into<BytesMut>) -> SecretBytesMut {
SecretBytesMut(bytes.into())
pub fn new(bytes: impl Into<BytesMut>) -> Self {
Self(bytes.into())
}
}
@ -37,8 +37,8 @@ impl fmt::Debug for SecretBytesMut {
}
impl From<BytesMut> for SecretBytesMut {
fn from(bytes: BytesMut) -> SecretBytesMut {
SecretBytesMut::new(bytes)
fn from(bytes: BytesMut) -> Self {
Self::new(bytes)
}
}