Skip to main content

KeyFixed

Struct KeyFixed 

Source
pub struct KeyFixed<const N: usize> { /* private fields */ }
Expand description

An owned, fixed-size key array that is wiped on drop.

No allocator is required. The engine validates whether the size is suitable. Storing an array here does not erase other copies, including the caller’s original array.

Implementations§

Source§

impl<const N: usize> KeyFixed<N>

Source

pub const fn new(key: [u8; N]) -> Self

Stores the supplied array without validating its size. Constant time with respect to key contents; copying cost depends on N.

Trait Implementations§

Source§

impl<const N: usize> Drop for KeyFixed<N>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<const N: usize> KeyParams for KeyFixed<N>

Source§

fn key(&self) -> &[u8] ⓘ

Returns the stored key bytes without copying them. Constant time: does not inspect key contents.

Source§

impl<const N: usize> Zeroize for KeyFixed<N>

Source§

fn zeroize(&mut self)

Overwrites the contents using volatile writes and a compiler fence to prevent removal of the wipe.
Source§

impl<const N: usize> ZeroizeOnDrop for KeyFixed<N>

Auto Trait Implementations§

§

impl<const N: usize> Forget for KeyFixed<N>

§

impl<const N: usize> Freeze for KeyFixed<N>
where [u8; N]: Freeze,

§

impl<const N: usize> Move for KeyFixed<N>

§

impl<const N: usize> RefUnwindSafe for KeyFixed<N>
where [u8; N]: RefUnwindSafe,

§

impl<const N: usize> Send for KeyFixed<N>
where [u8; N]: Send,

§

impl<const N: usize> Sync for KeyFixed<N>
where [u8; N]: Sync,

§

impl<const N: usize> Unpin for KeyFixed<N>
where [u8; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for KeyFixed<N>
where [u8; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for KeyFixed<N>
where [u8; N]: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.