pub struct SecretVec { /* private fields */ }Expand description
Owned heap secret bytes with initialized and spare-capacity cleanup.
Implementations§
Source§impl SecretVec
impl SecretVec
Sourcepub fn from_slice(bytes: &[u8]) -> Self
pub fn from_slice(bytes: &[u8]) -> Self
Copies caller-owned bytes into secret storage.
Sourcepub fn replace_from_vec(&mut self, replacement: Vec<u8>)
pub fn replace_from_vec(&mut self, replacement: Vec<u8>)
Replaces the owned bytes after wiping the displaced allocation.
The replacement’s spare capacity is wiped before ownership transfers. The previous initialized bytes and spare capacity are wiped before its allocation is released. This remains best-effort software cleanup and cannot remove historical copies or allocator metadata.
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_into_unprotected_vec(self) -> Vec<u8> ⓘ
pub fn declassify_into_unprotected_vec(self) -> Vec<u8> ⓘ
Deliberately returns an ordinary vector without crate-managed cleanup.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecretVec
impl RefUnwindSafe for SecretVec
impl Send for SecretVec
impl Sync for SecretVec
impl Unpin for SecretVec
impl UnsafeUnpin for SecretVec
impl UnwindSafe for SecretVec
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