pub struct RedoubtCodecBuffer { /* private fields */ }Implementations§
Source§impl RedoubtCodecBuffer
impl RedoubtCodecBuffer
pub fn with_capacity(capacity: usize) -> Self
pub fn realloc_with_capacity(&mut self, capacity: usize)
pub fn clear(&mut self)
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn write<T>(&mut self, src: &mut T) -> Result<(), RedoubtCodecBufferError>
pub fn write_slice<T>( &mut self, src: &mut [T], ) -> Result<(), RedoubtCodecBufferError>
Sourcepub fn export_as_vec(&mut self) -> Vec<u8> ⓘ
pub fn export_as_vec(&mut self) -> Vec<u8> ⓘ
Exports the buffer contents as a Vec<u8> and zeroizes the internal buffer.
This method creates a new Vec containing a copy of the buffer’s data,
then immediately zeroizes the internal buffer. The zeroization ensures
that sensitive data is cleared from the RedoubtCodecBuffer after export,
preventing potential memory leaks of plaintext data.
§Security
The zeroization happens after copying the data to the returned Vec,
ensuring the internal buffer is always cleaned up when data is exported.
This is crucial when the RedoubtCodecBuffer contains sensitive plaintext that
should not remain in memory after encoding is complete.
§Example
ⓘ
let mut buf = RedoubtCodecBuffer::with_capacity(10);
buf.write_usize(&42).unwrap();
let exported = buf.export_as_vec();
// buf is now zeroized, exported contains the dataTrait Implementations§
Source§impl AssertZeroizeOnDrop for RedoubtCodecBuffer
impl AssertZeroizeOnDrop for RedoubtCodecBuffer
Source§fn clone_sentinel(&self) -> ZeroizeOnDropSentinel
fn clone_sentinel(&self) -> ZeroizeOnDropSentinel
Clones the internal
ZeroizeOnDropSentinel for verification. Read moreSource§fn assert_zeroize_on_drop(self)
fn assert_zeroize_on_drop(self)
Asserts that zeroization happens when this value is dropped. Read more
Source§impl Default for RedoubtCodecBuffer
impl Default for RedoubtCodecBuffer
Source§impl Drop for RedoubtCodecBuffer
Available on crate feature zeroize only.
impl Drop for RedoubtCodecBuffer
Available on crate feature
zeroize only.Source§impl FastZeroizable for RedoubtCodecBuffer
impl FastZeroizable for RedoubtCodecBuffer
Source§fn fast_zeroize(&mut self)
fn fast_zeroize(&mut self)
Zeroizes the value in place. Read more
Source§impl ZeroizationProbe for RedoubtCodecBuffer
impl ZeroizationProbe for RedoubtCodecBuffer
Source§fn is_zeroized(&self) -> bool
fn is_zeroized(&self) -> bool
Returns
true if the value is zeroized (all bytes are 0). Read moreSource§impl ZeroizeMetadata for RedoubtCodecBuffer
impl ZeroizeMetadata for RedoubtCodecBuffer
Source§const CAN_BE_BULK_ZEROIZED: bool = false
const CAN_BE_BULK_ZEROIZED: bool = false
Whether this type can be bulk-zeroized with memset. Read more
Auto Trait Implementations§
impl Freeze for RedoubtCodecBuffer
impl RefUnwindSafe for RedoubtCodecBuffer
impl Send for RedoubtCodecBuffer
impl Sync for RedoubtCodecBuffer
impl Unpin for RedoubtCodecBuffer
impl UnwindSafe for RedoubtCodecBuffer
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