RedoubtCodecBuffer

Struct RedoubtCodecBuffer 

Source
pub struct RedoubtCodecBuffer { /* private fields */ }

Implementations§

Source§

impl RedoubtCodecBuffer

Source

pub fn with_capacity(capacity: usize) -> RedoubtCodecBuffer

Source

pub fn realloc_with_capacity(&mut self, capacity: usize)

Source

pub fn clear(&mut self)

Source

pub fn as_slice(&self) -> &[u8]

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn write<T>(&mut self, src: &mut T) -> Result<(), RedoubtCodecBufferError>

Source

pub fn write_slice<T>( &mut self, src: &mut [T], ) -> Result<(), RedoubtCodecBufferError>

Source

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 data

Trait Implementations§

Source§

impl AssertZeroizeOnDrop for RedoubtCodecBuffer

Source§

fn clone_sentinel(&self) -> ZeroizeOnDropSentinel

Clones the internal ZeroizeOnDropSentinel for verification. Read more
Source§

fn assert_zeroize_on_drop(self)

Asserts that zeroization happens when this value is dropped. Read more
Source§

impl Default for RedoubtCodecBuffer

Source§

fn default() -> RedoubtCodecBuffer

Returns the “default value” for a type. Read more
Source§

impl Drop for RedoubtCodecBuffer

Available on crate feature zeroize only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl FastZeroizable for RedoubtCodecBuffer

Source§

fn fast_zeroize(&mut self)

Zeroizes the value in place. Read more
Source§

impl ZeroizationProbe for RedoubtCodecBuffer

Source§

fn is_zeroized(&self) -> bool

Returns true if the value is zeroized (all bytes are 0). Read more
Source§

impl ZeroizeMetadata for RedoubtCodecBuffer

Source§

const CAN_BE_BULK_ZEROIZED: bool = false

Whether this type can be bulk-zeroized with memset. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> FastZeroize for T