Remove unnecessary Deserialize/Serialize derives

This commit is contained in:
Dirkjan Ochtman 2021-12-14 09:50:33 +01:00 committed by masalachai
parent 5664276133
commit b0595511e4
5 changed files with 39 additions and 42 deletions

View File

@ -78,11 +78,8 @@ impl ContactCreate {
// Response // Response
/// Type that represents the <creData> tag for contact create response /// Type that represents the <creData> tag for contact create response
#[derive(Serialize, Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct ContactCreateData { pub struct ContactCreateData {
/// XML namespace for contact response data
#[serde(rename = "xmlns:contact")]
xmlns: String,
/// The contact id /// The contact id
pub id: StringValue, pub id: StringValue,
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
@ -91,7 +88,7 @@ pub struct ContactCreateData {
} }
/// Type that represents the <resData> tag for contact create response /// Type that represents the <resData> tag for contact create response
#[derive(Serialize, Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct ContactCreateResponse { pub struct ContactCreateResponse {
/// Data under the <creData> tag /// Data under the <creData> tag
#[serde(rename = "creData")] #[serde(rename = "creData")]

View File

@ -24,7 +24,7 @@ pub struct HostAttr {
} }
/// The list of <hostAttr> types for domain transactions. Typically under an <ns> tag /// The list of <hostAttr> types for domain transactions. Typically under an <ns> tag
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostAttrList { pub struct HostAttrList {
/// The list of <hostAttr> tags /// The list of <hostAttr> tags
#[serde(rename = "domain:hostAttr", alias = "hostAttr")] #[serde(rename = "domain:hostAttr", alias = "hostAttr")]
@ -32,7 +32,7 @@ pub struct HostAttrList {
} }
/// The list of <hostObj> types for domain transactions. Typically under an <ns> tag /// The list of <hostObj> types for domain transactions. Typically under an <ns> tag
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Debug)]
pub struct HostObjList { pub struct HostObjList {
/// The list of <hostObj> tags /// The list of <hostObj> tags
#[serde(rename = "domain:hostObj", alias = "hostObj")] #[serde(rename = "domain:hostObj", alias = "hostObj")]
@ -41,7 +41,7 @@ pub struct HostObjList {
/// Enum that can accept one type which corresponds to either the <hostObj> or <hostAttr> /// Enum that can accept one type which corresponds to either the <hostObj> or <hostAttr>
/// list of tags /// list of tags
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Debug)]
#[serde(untagged)] #[serde(untagged)]
pub enum HostList { pub enum HostList {
HostObjList(HostObjList), HostObjList(HostObjList),
@ -60,7 +60,7 @@ pub struct DomainContact {
} }
/// The <period> type for registration, renewal or transfer on domain transactions /// The <period> type for registration, renewal or transfer on domain transactions
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Debug)]
pub struct Period { pub struct Period {
/// The interval (usually 'y' indicating years) /// The interval (usually 'y' indicating years)
unit: String, unit: String,

View File

@ -31,14 +31,14 @@ impl EppXml for HelloDocument {}
// Response // Response
/// Type for data within the <svcMenu> section of an EPP greeting /// Type for data within the <svcMenu> section of an EPP greeting
#[derive(Serialize, Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub struct ServiceMenu { pub struct ServiceMenu {
pub options: Options, pub options: Options,
pub services: Services, pub services: Services,
} }
/// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML /// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
struct FlattenedServiceMenu { struct FlattenedServiceMenu {
pub version: StringValue, pub version: StringValue,
pub lang: StringValue, pub lang: StringValue,
@ -72,31 +72,31 @@ impl<'de> Deserialize<'de> for ServiceMenu {
} }
/// Type corresponding to <all> in the EPP greeting XML /// Type corresponding to <all> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct All; pub struct All;
/// Type corresponding to <none> in the EPP greeting XML /// Type corresponding to <none> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct NoAccess; pub struct NoAccess;
/// Type corresponding to <null> in the EPP greeting XML /// Type corresponding to <null> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Null; pub struct Null;
/// Type corresponding to <personal> in the EPP greeting XML /// Type corresponding to <personal> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Personal; pub struct Personal;
/// Type corresponding to <personalAndOther> in the EPP greeting XML /// Type corresponding to <personalAndOther> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct PersonalAndOther; pub struct PersonalAndOther;
/// Type corresponding to <other> in the EPP greeting XML /// Type corresponding to <other> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Other; pub struct Other;
/// Type corresponding to possible <retention> type values /// Type corresponding to possible <retention> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub enum AccessType { pub enum AccessType {
/// Data for the <all> tag /// Data for the <all> tag
#[serde(rename = "all")] #[serde(rename = "all")]
@ -119,14 +119,14 @@ pub enum AccessType {
} }
/// Type corresponding to <access> in the EPP greeting XML /// Type corresponding to <access> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Access { pub struct Access {
#[serde(flatten)] #[serde(flatten)]
pub ty: AccessType, pub ty: AccessType,
} }
/// Type corresponding to possible <purpose> type values /// Type corresponding to possible <purpose> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub enum PurposeType { pub enum PurposeType {
/// Data for the <admin> tag /// Data for the <admin> tag
#[serde(rename = "admin")] #[serde(rename = "admin")]
@ -143,14 +143,14 @@ pub enum PurposeType {
} }
/// Type corresponding to <purpose> in the EPP greeting XML /// Type corresponding to <purpose> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Purpose { pub struct Purpose {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub purpose: Vec<PurposeType>, pub purpose: Vec<PurposeType>,
} }
/// Type corresponding to possible <purpose> type values /// Type corresponding to possible <purpose> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub enum RecipientType { pub enum RecipientType {
/// Data for the <other> tag /// Data for the <other> tag
#[serde(rename = "other")] #[serde(rename = "other")]
@ -170,34 +170,34 @@ pub enum RecipientType {
} }
/// Type corresponding to <recipeint> in the EPP greeting XML /// Type corresponding to <recipeint> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Recipient { pub struct Recipient {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub recipient: Vec<RecipientType>, pub recipient: Vec<RecipientType>,
} }
/// Type corresponding to <business> in the EPP greeting XML /// Type corresponding to <business> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Business; pub struct Business;
/// Type corresponding to <indefinite> in the EPP greeting XML /// Type corresponding to <indefinite> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Indefinite; pub struct Indefinite;
/// Type corresponding to <legal> in the EPP greeting XML /// Type corresponding to <legal> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Legal; pub struct Legal;
/// Type corresponding to <none> in the EPP greeting XML /// Type corresponding to <none> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct No; pub struct No;
/// Type corresponding to <stated> in the EPP greeting XML /// Type corresponding to <stated> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Stated; pub struct Stated;
/// Type corresponding to possible <retention> type values /// Type corresponding to possible <retention> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub enum RetentionType { pub enum RetentionType {
/// Data for the <business> tag /// Data for the <business> tag
#[serde(rename = "business")] #[serde(rename = "business")]
@ -217,14 +217,14 @@ pub enum RetentionType {
} }
/// Type corresponding to <retention> in the EPP greeting XML /// Type corresponding to <retention> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Retention { pub struct Retention {
#[serde(flatten)] #[serde(flatten)]
pub ty: RetentionType, pub ty: RetentionType,
} }
/// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation)
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Statement { pub struct Statement {
/// Data for the <purpose> tag /// Data for the <purpose> tag
pub purpose: Purpose, pub purpose: Purpose,
@ -235,21 +235,21 @@ pub struct Statement {
} }
/// Type corresponding to <absolute> value in the EPP greeting XML /// Type corresponding to <absolute> value in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Absolute { pub struct Absolute {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub absolute: StringValue, pub absolute: StringValue,
} }
/// Type corresponding to <relative> value in the EPP greeting XML /// Type corresponding to <relative> value in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Relative { pub struct Relative {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub relative: StringValue, pub relative: StringValue,
} }
/// Type corresponding to possible <expiry> type values /// Type corresponding to possible <expiry> type values
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub enum ExpiryType { pub enum ExpiryType {
/// Data for the <absolute> tag /// Data for the <absolute> tag
#[serde(rename = "absolute")] #[serde(rename = "absolute")]
@ -260,14 +260,14 @@ pub enum ExpiryType {
} }
/// Type corresponding to <expiry> in the EPP greeting XML /// Type corresponding to <expiry> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Expiry { pub struct Expiry {
#[serde(flatten)] #[serde(flatten)]
pub ty: ExpiryType, pub ty: ExpiryType,
} }
/// Type corresponding to <dcp> in the EPP greeting XML /// Type corresponding to <dcp> in the EPP greeting XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
pub struct Dcp { pub struct Dcp {
/// Data for the <access> tag /// Data for the <access> tag
pub access: Access, pub access: Access,
@ -277,7 +277,7 @@ pub struct Dcp {
pub expiry: Option<Expiry>, pub expiry: Option<Expiry>,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
/// Type corresponding to the <greeting> tag in the EPP greeting XML /// Type corresponding to the <greeting> tag in the EPP greeting XML
pub struct Greeting { pub struct Greeting {
@ -294,7 +294,7 @@ pub struct Greeting {
pub dcp: Dcp, pub dcp: Dcp,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, PartialEq)]
#[serde(rename = "epp")] #[serde(rename = "epp")]
pub struct GreetingDocument { pub struct GreetingDocument {
#[serde(rename = "greeting")] #[serde(rename = "greeting")]

View File

@ -1,6 +1,6 @@
use std::fmt::Debug; use std::fmt::Debug;
use serde::{Deserialize, Serialize}; use serde::Serialize;
use crate::{ use crate::{
common::{NoExtension, Options, ServiceExtension, Services, StringValue}, common::{NoExtension, Options, ServiceExtension, Services, StringValue},
@ -10,7 +10,7 @@ use crate::{
impl Transaction<NoExtension> for Login {} impl Transaction<NoExtension> for Login {}
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Debug, PartialEq)]
/// Type corresponding to the &lt;login&gt; tag in an EPP XML login request /// Type corresponding to the &lt;login&gt; tag in an EPP XML login request
pub struct Login { pub struct Login {
/// The username to use for the login /// The username to use for the login

View File

@ -2,7 +2,7 @@
use crate::common::NoExtension; use crate::common::NoExtension;
use crate::request::{Command, Transaction}; use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize}; use serde::Serialize;
impl Transaction<NoExtension> for MessageAck {} impl Transaction<NoExtension> for MessageAck {}
@ -11,7 +11,7 @@ impl Command for MessageAck {
const COMMAND: &'static str = "poll"; const COMMAND: &'static str = "poll";
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Debug)]
/// Type for EPP XML &lt;poll&gt; command for message ack /// Type for EPP XML &lt;poll&gt; command for message ack
pub struct MessageAck { pub struct MessageAck {
/// The type of operation to perform /// The type of operation to perform