Struct memsecurity::ZeroizeBytesArray
source · pub struct ZeroizeBytesArray<const N: usize>(/* private fields */);
Expand description
This is an array of variable length bytes that can be zeroed out on drop.
Structure
use bytes::BytesMut;
pub struct ZeroizeBytesArray<const N: usize>(BytesMut);
Implementations§
source§impl<const N: usize> ZeroizeBytesArray<N>
impl<const N: usize> ZeroizeBytesArray<N>
sourcepub fn new_with_data(value: [u8; N]) -> Self
pub fn new_with_data(value: [u8; N]) -> Self
Initialize the array and set the internal value of the array to the value specified by method argument
sourcepub fn new_with_csprng() -> Self
pub fn new_with_csprng() -> Self
Initialize the array and set the internal value of the array to the value specified by method argument
sourcepub fn set(self, value: [u8; N]) -> Self
pub fn set(self, value: [u8; N]) -> Self
Set the internal value of the array to the value specified by method argument
sourcepub fn set_bytes_mut(self, value: BytesMut) -> Self
pub fn set_bytes_mut(self, value: BytesMut) -> Self
Set the internal value of the array to the value specified by method argument value which is a BytesMut
sourcepub fn with_additional_capacity(capacity: usize) -> Self
pub fn with_additional_capacity(capacity: usize) -> Self
Initialize the array with the length specified by the generic const N
added to the value specified by the
method argument capacity:usize
(N + capacity)
sourcepub fn expose_borrowed(&self) -> &BytesMut
pub fn expose_borrowed(&self) -> &BytesMut
Expose the internal value of the array
Trait Implementations§
source§impl<const N: usize> BorshDeserialize for ZeroizeBytesArray<N>
impl<const N: usize> BorshDeserialize for ZeroizeBytesArray<N>
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
source§impl<const N: usize> BorshSerialize for ZeroizeBytesArray<N>
impl<const N: usize> BorshSerialize for ZeroizeBytesArray<N>
source§impl<const N: usize> Debug for ZeroizeBytesArray<N>
impl<const N: usize> Debug for ZeroizeBytesArray<N>
source§impl<const N: usize> Default for ZeroizeBytesArray<N>
impl<const N: usize> Default for ZeroizeBytesArray<N>
source§impl<const N: usize> Drop for ZeroizeBytesArray<N>
impl<const N: usize> Drop for ZeroizeBytesArray<N>
source§impl<const N: usize> PartialEq for ZeroizeBytesArray<N>
impl<const N: usize> PartialEq for ZeroizeBytesArray<N>
source§impl<const N: usize> Zeroize for ZeroizeBytesArray<N>
impl<const N: usize> Zeroize for ZeroizeBytesArray<N>
impl<const N: usize> Eq for ZeroizeBytesArray<N>
impl<const N: usize> ZeroizeOnDrop for ZeroizeBytesArray<N>
Auto Trait Implementations§
impl<const N: usize> RefUnwindSafe for ZeroizeBytesArray<N>
impl<const N: usize> Send for ZeroizeBytesArray<N>
impl<const N: usize> Sync for ZeroizeBytesArray<N>
impl<const N: usize> Unpin for ZeroizeBytesArray<N>
impl<const N: usize> UnwindSafe for ZeroizeBytesArray<N>
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