Use strum(serialize_all) instead of strum(to_string)

This commit is contained in:
Jonas Platte 2020-06-23 12:52:21 +02:00
parent c5db6d56ad
commit 75ea42961f
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -9,17 +9,15 @@ use strum::{AsRefStr, Display, EnumString};
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive] #[non_exhaustive]
#[strum(serialize_all = "snake_case")]
pub enum DeviceKeyAlgorithm { pub enum DeviceKeyAlgorithm {
/// The Ed25519 signature algorithm. /// The Ed25519 signature algorithm.
#[strum(to_string = "ed25519")]
Ed25519, Ed25519,
/// The Curve25519 ECDH algorithm. /// The Curve25519 ECDH algorithm.
#[strum(to_string = "curve25519")]
Curve25519, Curve25519,
/// The Curve25519 ECDH algorithm, but the key also contains signatures /// The Curve25519 ECDH algorithm, but the key also contains signatures
#[strum(to_string = "signed_curve25519")]
SignedCurve25519, SignedCurve25519,
} }
@ -27,8 +25,8 @@ pub enum DeviceKeyAlgorithm {
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)] #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, AsRefStr, Display, EnumString)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[non_exhaustive] #[non_exhaustive]
#[strum(serialize_all = "snake_case")]
pub enum ServerKeyAlgorithm { pub enum ServerKeyAlgorithm {
/// The Ed25519 signature algorithm. /// The Ed25519 signature algorithm.
#[strum(to_string = "ed25519")]
Ed25519, Ed25519,
} }