pub struct Nonce<const N: usize>(/* private fields */);Expand description
A fixed-size cryptographic nonce.
§Security
Using a typed wrapper prevents accidentally passing truncated hashes,
key fragments, or other byte arrays where a nonce is expected. The const
generic parameter enforces size at compile time — Nonce<16> and
Nonce<12> are distinct types that cannot be mixed.
Implementations§
Trait Implementations§
impl<const N: usize> Copy for Nonce<N>
impl<const N: usize> Eq for Nonce<N>
impl<const N: usize> StructuralPartialEq for Nonce<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Nonce<N>
impl<const N: usize> RefUnwindSafe for Nonce<N>
impl<const N: usize> Send for Nonce<N>
impl<const N: usize> Sync for Nonce<N>
impl<const N: usize> Unpin for Nonce<N>
impl<const N: usize> UnsafeUnpin for Nonce<N>
impl<const N: usize> UnwindSafe for Nonce<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)