impl std::convert::TryFrom<u16> for $name { type Error = crate::Error;
fn try_from(v: u16) -> Result<Self, Self::Error> { match v {
$($(#[$vmeta])*
x if x == $name::$vname as u16
=> Ok($name::$vname),)*
_ => Err(crate::Error::Unsupported),
}
}
}
impl std::convert::From<$name> for u16 {
fn from(v: $name) -> u16 {
v as u16
}
}
}
}
impl Aead { /// The size of the key for this AEAD. #[must_use] pub fn n_k(self) -> usize { matchself {
Aead::Aes128Gcm => 16,
Aead::Aes256Gcm | Aead::ChaCha20Poly1305 => 32,
}
}
/// The size of the nonce for this AEAD. #[must_use] pub fn n_n(self) -> usize { matchself {
Aead::Aes128Gcm | Aead::Aes256Gcm | Aead::ChaCha20Poly1305 => 12,
}
}
/// The size of the tag for this AEAD. #[must_use] #[allow(clippy::unused_self)] // This is only presently constant. pub fn n_t(self) -> usize { 16
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.