#[non_exhaustive]pub enum NonceBytes {
X24([u8; 24]),
Short12([u8; 12]),
}Expand description
Per-AEAD-kind nonce carrier — XChaCha20-Poly1305 uses 24 bytes, the AES-256-GCM family uses 12. A single variant enum keeps the on-wire layout round-trip stable under postcard. Variants use postcard’s default untagged discriminant (enum index byte).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
X24([u8; 24])
24-byte nonce — XChaCha20-Poly1305.
Short12([u8; 12])
12-byte nonce — AES-256-GCM / AES-256-GCM-SIV.
Implementations§
Source§impl NonceBytes
impl NonceBytes
Sourcepub fn expected_len(kind: AeadKind) -> usize
pub fn expected_len(kind: AeadKind) -> usize
Expected length for the given AeadKind. Forward-compat unknown
variants map to 0 so callers can catch the mismatch as
PiiError::UnsupportedAead.
Trait Implementations§
Source§impl Clone for NonceBytes
impl Clone for NonceBytes
Source§fn clone(&self) -> NonceBytes
fn clone(&self) -> NonceBytes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NonceBytes
impl Debug for NonceBytes
Source§impl<'de> Deserialize<'de> for NonceBytes
impl<'de> Deserialize<'de> for NonceBytes
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for NonceBytes
impl PartialEq for NonceBytes
Source§fn eq(&self, other: &NonceBytes) -> bool
fn eq(&self, other: &NonceBytes) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for NonceBytes
impl Serialize for NonceBytes
impl Eq for NonceBytes
impl StructuralPartialEq for NonceBytes
Auto Trait Implementations§
impl Freeze for NonceBytes
impl RefUnwindSafe for NonceBytes
impl Send for NonceBytes
impl Sync for NonceBytes
impl Unpin for NonceBytes
impl UnsafeUnpin for NonceBytes
impl UnwindSafe for NonceBytes
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.