Loading crates/s3s/src/auth/secret_key.rs +18 −12 Original line number Diff line number Diff line Loading @@ -3,23 +3,29 @@ use std::fmt; use zeroize::Zeroize; #[derive(Clone, PartialEq, Eq)] pub struct SecretKey(String); impl Zeroize for SecretKey { fn zeroize(&mut self) { self.0.zeroize(); } } pub struct SecretKey(Box<str>); impl SecretKey { #[inline(always)] fn new(s: String) -> Self { Self(s) fn new(s: impl Into<Box<str>>) -> Self { Self(s.into()) } #[must_use] pub fn expose(&self) -> &str { self.0.as_str() &self.0 } } impl Zeroize for SecretKey { fn zeroize(&mut self) { self.0.zeroize(); } } impl Drop for SecretKey { fn drop(&mut self) { self.zeroize(); } } Loading @@ -31,13 +37,13 @@ impl From<String> for SecretKey { impl From<Box<str>> for SecretKey { fn from(value: Box<str>) -> Self { Self::new(value.into()) Self::new(value) } } impl From<&str> for SecretKey { fn from(value: &str) -> Self { Self::new(value.into()) Self::new(value) } } Loading crates/s3s/src/ops/mod.rs +6 −6 Original line number Diff line number Diff line Loading @@ -705,17 +705,17 @@ mod tests { #[rustfmt::skip] let sizes = [ future_size!(S3Service::call, 2616), future_size!(call, 1432), future_size!(prepare, 1360), future_size!(SignatureContext::check, 752), future_size!(S3Service::call, 2600), future_size!(call, 1424), future_size!(prepare, 1352), future_size!(SignatureContext::check, 744), future_size!(SignatureContext::v2_check, 280), future_size!(SignatureContext::v2_check_presigned_url, 184), future_size!(SignatureContext::v2_check_header_auth, 184), future_size!(SignatureContext::v4_check, 728), future_size!(SignatureContext::v4_check, 720), future_size!(SignatureContext::v4_check_post_signature, 368), future_size!(SignatureContext::v4_check_presigned_url, 456), future_size!(SignatureContext::v4_check_header_auth, 632), future_size!(SignatureContext::v4_check_header_auth, 624), ]; println!("{:#?}", sizes); Loading Loading
crates/s3s/src/auth/secret_key.rs +18 −12 Original line number Diff line number Diff line Loading @@ -3,23 +3,29 @@ use std::fmt; use zeroize::Zeroize; #[derive(Clone, PartialEq, Eq)] pub struct SecretKey(String); impl Zeroize for SecretKey { fn zeroize(&mut self) { self.0.zeroize(); } } pub struct SecretKey(Box<str>); impl SecretKey { #[inline(always)] fn new(s: String) -> Self { Self(s) fn new(s: impl Into<Box<str>>) -> Self { Self(s.into()) } #[must_use] pub fn expose(&self) -> &str { self.0.as_str() &self.0 } } impl Zeroize for SecretKey { fn zeroize(&mut self) { self.0.zeroize(); } } impl Drop for SecretKey { fn drop(&mut self) { self.zeroize(); } } Loading @@ -31,13 +37,13 @@ impl From<String> for SecretKey { impl From<Box<str>> for SecretKey { fn from(value: Box<str>) -> Self { Self::new(value.into()) Self::new(value) } } impl From<&str> for SecretKey { fn from(value: &str) -> Self { Self::new(value.into()) Self::new(value) } } Loading
crates/s3s/src/ops/mod.rs +6 −6 Original line number Diff line number Diff line Loading @@ -705,17 +705,17 @@ mod tests { #[rustfmt::skip] let sizes = [ future_size!(S3Service::call, 2616), future_size!(call, 1432), future_size!(prepare, 1360), future_size!(SignatureContext::check, 752), future_size!(S3Service::call, 2600), future_size!(call, 1424), future_size!(prepare, 1352), future_size!(SignatureContext::check, 744), future_size!(SignatureContext::v2_check, 280), future_size!(SignatureContext::v2_check_presigned_url, 184), future_size!(SignatureContext::v2_check_header_auth, 184), future_size!(SignatureContext::v4_check, 728), future_size!(SignatureContext::v4_check, 720), future_size!(SignatureContext::v4_check_post_signature, 368), future_size!(SignatureContext::v4_check_presigned_url, 456), future_size!(SignatureContext::v4_check_header_auth, 632), future_size!(SignatureContext::v4_check_header_auth, 624), ]; println!("{:#?}", sizes); Loading