pub struct SecretOutput<'a> { /* private fields */ }Expand description
Borrowed secret output with full-range cleanup on drop.
Construction wipes unused tail bytes. Drop wipes the complete borrowed
range. A consuming Self::declassify call deliberately transfers the
bytes into an ordinary non-wiping view.
Implementations§
Source§impl<'a> SecretOutput<'a>
impl<'a> SecretOutput<'a>
Sourcepub fn from_initialized(
storage: &'a mut [u8],
len: usize,
) -> Result<Self, BufferLengthError>
pub fn from_initialized( storage: &'a mut [u8], len: usize, ) -> Result<Self, BufferLengthError>
Wraps one initialized prefix and assumes cleanup responsibility.
Invalid lengths wipe the complete range before returning an error.
Sourcepub fn empty(storage: &'a mut [u8]) -> Self
pub fn empty(storage: &'a mut [u8]) -> Self
Creates an empty output guard after wiping the complete range.
Sourcepub fn expose_secret(&self) -> ExposedSecret<'_>
pub fn expose_secret(&self) -> ExposedSecret<'_>
Creates an explicit borrowed interoperability view.
Sourcepub fn expose_secret_mut(&mut self) -> ExposedSecretMut<'_>
pub fn expose_secret_mut(&mut self) -> ExposedSecretMut<'_>
Creates an explicit mutable interoperability view.
Sourcepub fn declassify(self) -> DeclassifiedOutput<'a>
pub fn declassify(self) -> DeclassifiedOutput<'a>
Deliberately transfers the initialized prefix into ordinary storage.
The returned view does not wipe on drop. Its tail remains zeroed, and the caller becomes responsible for any later cleanup requirement.
Trait Implementations§
Source§impl Debug for SecretOutput<'_>
impl Debug for SecretOutput<'_>
Source§impl Display for SecretOutput<'_>
impl Display for SecretOutput<'_>
Source§impl Drop for SecretOutput<'_>
impl Drop for SecretOutput<'_>
Auto Trait Implementations§
impl<'a> !UnwindSafe for SecretOutput<'a>
impl<'a> Freeze for SecretOutput<'a>
impl<'a> RefUnwindSafe for SecretOutput<'a>
impl<'a> Send for SecretOutput<'a>
impl<'a> Sync for SecretOutput<'a>
impl<'a> Unpin for SecretOutput<'a>
impl<'a> UnsafeUnpin for SecretOutput<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more