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
/// Type that represents the <creData> tag for contact create response
#[derive(Serialize, Deserialize, Debug)]
#[derive(Deserialize, Debug)]
pub struct ContactCreateData {
/// XML namespace for contact response data
#[serde(rename = "xmlns:contact")]
xmlns: String,
/// The contact id
pub id: StringValue,
#[serde(rename = "crDate")]
@ -91,7 +88,7 @@ pub struct ContactCreateData {
}
/// Type that represents the <resData> tag for contact create response
#[derive(Serialize, Deserialize, Debug)]
#[derive(Deserialize, Debug)]
pub struct ContactCreateResponse {
/// Data under the <creData> tag
#[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
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Debug)]
pub struct HostAttrList {
/// The list of <hostAttr> tags
#[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
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Debug)]
pub struct HostObjList {
/// The list of <hostObj> tags
#[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>
/// list of tags
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Debug)]
#[serde(untagged)]
pub enum HostList {
HostObjList(HostObjList),
@ -60,7 +60,7 @@ pub struct DomainContact {
}
/// The <period> type for registration, renewal or transfer on domain transactions
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Debug)]
pub struct Period {
/// The interval (usually 'y' indicating years)
unit: String,

View File

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

View File

@ -1,6 +1,6 @@
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use serde::Serialize;
use crate::{
common::{NoExtension, Options, ServiceExtension, Services, StringValue},
@ -10,7 +10,7 @@ use crate::{
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
pub struct Login {
/// The username to use for the login

View File

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