pub struct SecretArrayVec<T: SecureSanitize, const CAP: usize> { /* private fields */ }Expand description
Clear-on-drop wrapper around ArrayVec.
Live elements are sanitized before the vector is cleared. Spare uninitialized
storage is not treated as secret material because it has never held a T.
Implementations§
Source§impl<T: SecureSanitize, const CAP: usize> SecretArrayVec<T, CAP>
impl<T: SecureSanitize, const CAP: usize> SecretArrayVec<T, CAP>
Sourcepub const fn from_arrayvec(inner: ArrayVec<T, CAP>) -> Self
pub const fn from_arrayvec(inner: ArrayVec<T, CAP>) -> Self
Wrap an existing ArrayVec.
Sourcepub fn push(&mut self, value: T) -> Result<(), CapacityError<T>>
pub fn push(&mut self, value: T) -> Result<(), CapacityError<T>>
Push one sanitizable element.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Mutably borrow initialized elements.
Sourcepub fn with_secret<R>(&self, inspect: impl FnOnce(&[T]) -> R) -> R
pub fn with_secret<R>(&self, inspect: impl FnOnce(&[T]) -> R) -> R
Run a closure with read-only access to initialized elements.
Sourcepub fn with_secret_mut<R>(&mut self, edit: impl FnOnce(&mut [T]) -> R) -> R
pub fn with_secret_mut<R>(&mut self, edit: impl FnOnce(&mut [T]) -> R) -> R
Run a closure with mutable access to initialized elements.
Sourcepub fn clear_secret(&mut self)
pub fn clear_secret(&mut self)
Sanitize all live elements and clear the vector.
Sourcepub fn into_cleared(self)
pub fn into_cleared(self)
Consume after first sanitizing all live elements.
Trait Implementations§
Source§impl<T: SecureSanitize, const CAP: usize> Debug for SecretArrayVec<T, CAP>
impl<T: SecureSanitize, const CAP: usize> Debug for SecretArrayVec<T, CAP>
Source§impl<T: SecureSanitize, const CAP: usize> Default for SecretArrayVec<T, CAP>
impl<T: SecureSanitize, const CAP: usize> Default for SecretArrayVec<T, CAP>
Source§impl<T: SecureSanitize, const CAP: usize> Drop for SecretArrayVec<T, CAP>
impl<T: SecureSanitize, const CAP: usize> Drop for SecretArrayVec<T, CAP>
Source§impl<T: SecureSanitize, const CAP: usize> SecureSanitize for SecretArrayVec<T, CAP>
impl<T: SecureSanitize, const CAP: usize> SecureSanitize for SecretArrayVec<T, CAP>
Source§fn secure_sanitize(&mut self)
fn secure_sanitize(&mut self)
Clear the sensitive bytes owned by this value.
Auto Trait Implementations§
impl<T, const CAP: usize> Freeze for SecretArrayVec<T, CAP>where
T: Freeze,
impl<T, const CAP: usize> RefUnwindSafe for SecretArrayVec<T, CAP>where
T: RefUnwindSafe,
impl<T, const CAP: usize> Send for SecretArrayVec<T, CAP>where
T: Send,
impl<T, const CAP: usize> Sync for SecretArrayVec<T, CAP>where
T: Sync,
impl<T, const CAP: usize> Unpin for SecretArrayVec<T, CAP>where
T: Unpin,
impl<T, const CAP: usize> UnsafeUnpin for SecretArrayVec<T, CAP>where
T: UnsafeUnpin,
impl<T, const CAP: usize> UnwindSafe for SecretArrayVec<T, CAP>where
T: UnwindSafe,
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