Use &str or Cow<'a, str> in place of String

This commit is contained in:
Dirkjan Ochtman 2021-12-14 11:56:05 +01:00 committed by masalachai
parent 99701608a2
commit 17d5bd90e9
18 changed files with 138 additions and 140 deletions

View File

@ -81,45 +81,45 @@ pub struct Services<'a> {
/// The &lt;hostAddr&gt; types domain or host transactions
#[derive(Serialize, Deserialize, Debug)]
pub struct HostAddr {
pub struct HostAddr<'a> {
#[serde(rename = "ip")]
pub ip_version: Option<String>,
pub ip_version: Option<Cow<'a, str>>,
#[serde(rename = "$value")]
pub address: String,
pub address: Cow<'a, str>,
}
impl HostAddr {
impl<'a> HostAddr<'a> {
/// Creates a 'v4' type HostAddr (mostly useful when you don't want to include an 'ip' attr in the XML)
pub fn new(ip_version: &str, address: &str) -> HostAddr {
HostAddr {
ip_version: Some(ip_version.to_string()),
address: address.to_string(),
pub fn new(ip_version: &'a str, address: &'a str) -> Self {
Self {
ip_version: Some(ip_version.into()),
address: address.into(),
}
}
/// Creates a 'v4' type HostAddr
pub fn new_v4(address: &str) -> HostAddr {
pub fn new_v4(address: &'a str) -> HostAddr {
HostAddr {
ip_version: Some("v4".to_string()),
address: address.to_string(),
ip_version: Some("v4".into()),
address: address.into(),
}
}
/// Creates a 'v6' type HostAddr
pub fn new_v6(address: &str) -> HostAddr {
pub fn new_v6(address: &'a str) -> HostAddr {
HostAddr {
ip_version: Some("v6".to_string()),
address: address.to_string(),
ip_version: Some("v6".into()),
address: address.into(),
}
}
}
/// The &lt;status&gt; type on contact transactions
#[derive(Serialize, Deserialize, Debug)]
pub struct ObjectStatus {
pub struct ObjectStatus<'a> {
/// The status name, represented by the 's' attr on &lt;status&gt; tags
#[serde(rename = "s")]
pub status: String,
pub status: Cow<'a, str>,
}
/// This type contains a single DER-encoded X.509 certificate.

View File

@ -1,3 +1,4 @@
use std::borrow::Cow;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
@ -50,27 +51,27 @@ impl<'a> ContactAuthInfo<'a> {
/// The data for &lt;voice&gt; and &lt;fax&gt; types on domain transactions
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Phone {
pub struct Phone<'a> {
/// The inner text on the &lt;voice&gt; and &lt;fax&gt; tags
#[serde(rename = "$value")]
pub number: String,
pub number: Cow<'a, str>,
/// The value of the 'x' attr on &lt;voice&gt; and &lt;fax&gt; tags
#[serde(rename = "x")]
pub extension: Option<String>,
pub extension: Option<Cow<'a, str>>,
}
impl Phone {
impl<'a> Phone<'a> {
/// Creates a new Phone instance with a given phone number
pub fn new(number: &str) -> Phone {
Phone {
pub fn new(number: &'a str) -> Self {
Self {
extension: None,
number: number.to_string(),
number: number.into(),
}
}
/// Sets the extension value of the Phone type
pub fn set_extension(&mut self, ext: &str) {
self.extension = Some(ext.to_string());
pub fn set_extension(&mut self, ext: &'a str) {
self.extension = Some(ext.into());
}
}

View File

@ -28,10 +28,10 @@ pub struct Contact<'a> {
postal_info: PostalInfo<'a>,
/// Contact &lt;voice&gt; tag
#[serde(rename = "contact:voice")]
voice: Phone,
voice: Phone<'a>,
/// Contact &lt;fax&gt; tag,
#[serde(rename = "contact:fax")]
fax: Option<Phone>,
fax: Option<Phone<'a>>,
/// Contact &lt;email&gt; tag
#[serde(rename = "contact:email")]
email: StringValue<'a>,
@ -53,7 +53,7 @@ impl<'a> ContactCreate<'a> {
id: &'a str,
email: &'a str,
postal_info: PostalInfo<'a>,
voice: Phone,
voice: Phone<'a>,
auth_password: &'a str,
) -> Self {
Self {
@ -70,7 +70,7 @@ impl<'a> ContactCreate<'a> {
}
/// Sets the &lt;fax&gt; data for the request
pub fn set_fax(&mut self, fax: Phone) {
pub fn set_fax(&mut self, fax: Phone<'a>) {
self.contact.fax = Some(fax);
}
}

View File

@ -59,14 +59,14 @@ pub struct ContactInfoData<'a> {
pub roid: StringValue<'a>,
/// The list of contact statuses
#[serde(rename = "status")]
pub statuses: Vec<ObjectStatus>,
pub statuses: Vec<ObjectStatus<'a>>,
/// The postal info for the contact
#[serde(rename = "postalInfo")]
pub postal_info: PostalInfo<'a>,
/// The voice data for the contact
pub voice: Phone,
pub voice: Phone<'a>,
/// The fax data for the contact
pub fax: Option<Phone>,
pub fax: Option<Phone<'a>>,
/// The email for the contact
pub email: StringValue<'a>,
/// The epp user to whom the contact belongs

View File

@ -30,7 +30,7 @@ impl<'a> ContactUpdate<'a> {
&mut self,
email: &'a str,
postal_info: PostalInfo<'a>,
voice: Phone,
voice: Phone<'a>,
auth_password: &'a str,
) {
self.contact.change_info = Some(ContactChangeInfo {
@ -43,7 +43,7 @@ impl<'a> ContactUpdate<'a> {
}
/// Sets the data for the &lt;fax&gt; tag under &lt;chg&gt; for the contact update request
pub fn set_fax(&mut self, fax: Phone) {
pub fn set_fax(&mut self, fax: Phone<'a>) {
if let Some(info) = &mut self.contact.change_info {
info.fax = Some(fax)
}
@ -66,9 +66,9 @@ pub struct ContactChangeInfo<'a> {
#[serde(rename = "contact:postalInfo")]
postal_info: Option<PostalInfo<'a>>,
#[serde(rename = "contact:voice")]
voice: Option<Phone>,
voice: Option<Phone<'a>>,
#[serde(rename = "contact:fax")]
fax: Option<Phone>,
fax: Option<Phone<'a>>,
#[serde(rename = "contact:email")]
email: Option<StringValue<'a>>,
#[serde(rename = "contact:authInfo")]
@ -79,7 +79,7 @@ pub struct ContactChangeInfo<'a> {
#[derive(Serialize, Debug)]
pub struct StatusList<'a> {
#[serde(rename = "contact:status")]
status: &'a [ObjectStatus],
status: &'a [ObjectStatus<'a>],
}
/// Type for elements under the contact &lt;update&gt; tag
@ -126,11 +126,11 @@ mod tests {
object.set_info("newemail@eppdev.net", postal_info, voice, "eppdev-387323");
let add_statuses = &[ObjectStatus {
status: "clientTransferProhibited".to_string(),
status: "clientTransferProhibited".into(),
}];
object.add(add_statuses);
let remove_statuses = &[ObjectStatus {
status: "clientDeleteProhibited".to_string(),
status: "clientDeleteProhibited".into(),
}];
object.remove(remove_statuses);

View File

@ -1,3 +1,5 @@
use std::borrow::Cow;
use serde::{Deserialize, Serialize};
use crate::common::{HostAddr, StringValue};
@ -20,7 +22,7 @@ pub struct HostAttr<'a> {
pub name: StringValue<'a>,
/// The &lt;hostAddr&gt; tags
#[serde(rename = "domain:hostAddr", alias = "hostAddr")]
pub addresses: Option<Vec<HostAddr>>,
pub addresses: Option<Vec<HostAddr<'a>>>,
}
/// The list of &lt;hostAttr&gt; types for domain transactions. Typically under an &lt;ns&gt; tag
@ -50,13 +52,13 @@ pub enum HostList<'a> {
/// The &lt;contact&gt; type on domain creation and update requests
#[derive(Serialize, Deserialize, Debug)]
pub struct DomainContact {
pub struct DomainContact<'a> {
/// The contact id
#[serde(rename = "$value")]
pub id: String,
pub id: Cow<'a, str>,
/// The contact type attr (usually admin, billing, or tech in most registries)
#[serde(rename = "type")]
pub contact_type: String,
pub contact_type: Cow<'a, str>,
}
/// The &lt;period&gt; type for registration, renewal or transfer on domain transactions

View File

@ -36,7 +36,7 @@ pub struct DomainCreateRequestData<'a> {
pub registrant: Option<StringValue<'a>>,
/// The list of contacts for the domain
#[serde(rename = "domain:contact")]
pub contacts: Option<&'a [DomainContact]>,
pub contacts: Option<&'a [DomainContact<'a>]>,
/// The auth info for the domain
#[serde(rename = "domain:authInfo")]
pub auth_info: DomainAuthInfo<'a>,
@ -59,7 +59,7 @@ impl<'a> DomainCreate<'a> {
ns: Option<HostList<'a>>,
registrant_id: Option<&'a str>,
auth_password: &'a str,
contacts: Option<&'a [DomainContact]>,
contacts: Option<&'a [DomainContact<'a>]>,
) -> Self {
Self {
domain: DomainCreateRequestData {
@ -115,16 +115,16 @@ mod tests {
let contacts = &[
DomainContact {
contact_type: "admin".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "admin".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "tech".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "tech".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "billing".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "billing".into(),
id: "eppdev-contact-3".into(),
},
];
@ -150,16 +150,16 @@ mod tests {
let contacts = &[
DomainContact {
contact_type: "admin".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "admin".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "tech".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "tech".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "billing".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "billing".into(),
id: "eppdev-contact-3".into(),
},
];
@ -186,16 +186,16 @@ mod tests {
let contacts = &[
DomainContact {
contact_type: "admin".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "admin".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "tech".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "tech".into(),
id: "eppdev-contact-3".into(),
},
DomainContact {
contact_type: "billing".to_string(),
id: "eppdev-contact-3".to_string(),
contact_type: "billing".into(),
id: "eppdev-contact-3".into(),
},
];

View File

@ -17,10 +17,7 @@ impl<'a> DomainInfo<'a> {
Self {
info: DomainInfoRequestData {
xmlns: XMLNS,
domain: Domain {
hosts: "all".to_string(),
name: name.to_string(),
},
domain: Domain { hosts: "all", name },
auth_info: auth_password.map(|password| DomainAuthInfo {
password: password.into(),
}),
@ -33,12 +30,12 @@ impl<'a> DomainInfo<'a> {
/// Type for data under the &lt;name&gt; element tag for the domain &lt;info&gt; tag
#[derive(Serialize, Debug)]
pub struct Domain {
pub struct Domain<'a> {
/// The hosts attribute. Default value is "all"
hosts: String,
hosts: &'a str,
/// The name of the domain
#[serde(rename = "$value")]
name: String,
name: &'a str,
}
/// Type for &lt;name&gt; element under the domain &lt;info&gt; tag
@ -49,7 +46,7 @@ pub struct DomainInfoRequestData<'a> {
xmlns: &'a str,
/// The data for the domain to be queried
#[serde(rename = "domain:name")]
domain: Domain,
domain: Domain<'a>,
/// The auth info for the domain
#[serde(rename = "domain:authInfo")]
auth_info: Option<DomainAuthInfo<'a>>,
@ -85,12 +82,12 @@ pub struct DomainInfoResponseData {
pub roid: StringValue<'static>,
/// The list of domain statuses
#[serde(rename = "status")]
pub statuses: Option<Vec<ObjectStatus>>,
pub statuses: Option<Vec<ObjectStatus<'static>>>,
/// The domain registrant
pub registrant: Option<StringValue<'static>>,
/// The list of domain contacts
#[serde(rename = "contact")]
pub contacts: Option<Vec<DomainContact>>,
pub contacts: Option<Vec<DomainContact<'static>>>,
/// The list of domain nameservers
#[serde(rename = "ns")]
pub ns: Option<DomainNsList>,

View File

@ -50,7 +50,7 @@ impl<'a> DomainTransfer<'a> {
auth_info: Option<DomainAuthInfo<'a>>,
) -> Self {
Self {
operation: operation.to_string(),
operation,
domain: DomainTransferReqData {
xmlns: XMLNS,
name: name.into(),
@ -88,7 +88,7 @@ pub struct DomainTransfer<'a> {
/// The transfer operation to perform indicated by the 'op' attr
/// The values are one of transfer or query
#[serde(rename = "op")]
operation: String,
operation: &'a str,
/// The data under the &lt;transfer&gt; tag in the transfer request
#[serde(rename = "domain:transfer")]
domain: DomainTransferReqData<'a>,

View File

@ -64,10 +64,10 @@ pub struct DomainAddRemove<'a> {
pub ns: Option<HostList<'a>>,
/// The list of contacts to add to or remove from the domain
#[serde(rename = "domain:contact")]
pub contacts: Option<&'a [DomainContact]>,
pub contacts: Option<&'a [DomainContact<'a>]>,
/// The list of statuses to add to or remove from the domain
#[serde(rename = "domain:status")]
pub statuses: Option<&'a [ObjectStatus]>,
pub statuses: Option<&'a [ObjectStatus<'a>]>,
}
/// Type for elements under the &lt;update&gt; tag for domain update
@ -113,7 +113,7 @@ mod tests {
let mut object = DomainUpdate::new("eppdev.com");
let statuses = &[ObjectStatus {
status: "clientDeleteProhibited".to_string(),
status: "clientDeleteProhibited".into(),
}];
let add = DomainAddRemove {
@ -123,8 +123,8 @@ mod tests {
};
let contacts = &[DomainContact {
contact_type: "billing".to_string(),
id: "eppdev-contact-2".to_string(),
contact_type: "billing".into(),
id: "eppdev-contact-2".into(),
}];
let remove = DomainAddRemove {

View File

@ -1,5 +1,7 @@
//! Types for EPP namestore request and responses
use std::borrow::Cow;
use serde::{Deserialize, Serialize};
use crate::{
@ -23,62 +25,62 @@ pub const XMLNS: &str = "http://www.verisign-grs.com/epp/namestoreExt-1.1";
// Contact
impl<'a> Transaction<NameStore> for ContactCheck<'a> {}
impl<'a> Transaction<NameStore> for ContactCreate<'a> {}
impl<'a> Transaction<NameStore> for ContactDelete<'a> {}
impl<'a> Transaction<NameStore> for ContactInfo<'a> {}
impl<'a> Transaction<NameStore> for ContactUpdate<'a> {}
impl<'a> Transaction<NameStore<'a>> for ContactCheck<'a> {}
impl<'a> Transaction<NameStore<'a>> for ContactCreate<'a> {}
impl<'a> Transaction<NameStore<'a>> for ContactDelete<'a> {}
impl<'a> Transaction<NameStore<'a>> for ContactInfo<'a> {}
impl<'a> Transaction<NameStore<'a>> for ContactUpdate<'a> {}
// Domain
impl<'a> Transaction<NameStore> for DomainCheck<'a> {}
impl<'a> Transaction<NameStore> for DomainCreate<'a> {}
impl<'a> Transaction<NameStore> for DomainDelete<'a> {}
impl<'a> Transaction<NameStore> for DomainInfo<'a> {}
impl<'a> Transaction<NameStore> for DomainRenew<'a> {}
impl<'a> Transaction<NameStore> for DomainTransfer<'a> {}
impl<'a> Transaction<NameStore> for DomainUpdate<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainCheck<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainCreate<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainDelete<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainInfo<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainRenew<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainTransfer<'a> {}
impl<'a> Transaction<NameStore<'a>> for DomainUpdate<'a> {}
// Host
impl<'a> Transaction<NameStore> for HostCheck<'a> {}
impl<'a> Transaction<NameStore> for HostCreate<'a> {}
impl<'a> Transaction<NameStore> for HostDelete<'a> {}
impl<'a> Transaction<NameStore> for HostInfo<'a> {}
impl<'a> Transaction<NameStore> for HostUpdate<'a> {}
impl<'a> Transaction<NameStore<'a>> for HostCheck<'a> {}
impl<'a> Transaction<NameStore<'a>> for HostCreate<'a> {}
impl<'a> Transaction<NameStore<'a>> for HostDelete<'a> {}
impl<'a> Transaction<NameStore<'a>> for HostInfo<'a> {}
impl<'a> Transaction<NameStore<'a>> for HostUpdate<'a> {}
impl NameStore {
impl<'a> NameStore<'a> {
/// Create a new RGP restore report request
pub fn new(subproduct: &str) -> NameStore {
NameStore {
data: NameStoreData {
xmlns: XMLNS.to_string(),
xmlns: XMLNS.into(),
subproduct: subproduct.to_owned().into(),
},
}
}
}
impl Extension for NameStore {
type Response = NameStore;
impl<'a> Extension for NameStore<'a> {
type Response = NameStore<'static>;
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename = "namestoreExt:namestoreExt")]
pub struct NameStore {
pub struct NameStore<'a> {
#[serde(rename = "namestoreExt:namestoreExt", alias = "namestoreExt")]
pub data: NameStoreData,
pub data: NameStoreData<'a>,
}
#[derive(Serialize, Deserialize, Debug)]
/// Type for EPP XML &lt;namestoreExt&gt; extension
pub struct NameStoreData {
pub struct NameStoreData<'a> {
/// XML namespace for the RGP restore extension
#[serde(rename = "xmlns:namestoreExt", alias = "xmlns")]
pub xmlns: String,
pub xmlns: Cow<'a, str>,
/// The object holding the list of domains to be checked
#[serde(rename = "namestoreExt:subProduct", alias = "subProduct")]
pub subproduct: StringValue<'static>,
pub subproduct: StringValue<'a>,
}
#[cfg(test)]

View File

@ -26,7 +26,7 @@ impl<'a> RgpRestoreReport<'a> {
Self {
xmlns: XMLNS,
restore: RgpRestoreReportSection {
op: "report".to_string(),
op: "report",
report: RgpRestoreReportSectionData {
pre_data: pre_data.into(),
post_data: post_data.into(),
@ -79,7 +79,7 @@ pub struct RgpRestoreReportSectionData<'a> {
#[derive(Serialize, Debug)]
pub struct RgpRestoreReportSection<'a> {
/// The value of the op attribute for the &lt;restore&gt; tag
op: String,
op: &'a str,
/// Data for the &lt;report&gt; tag
#[serde(rename = "rgp:report")]
report: RgpRestoreReportSectionData<'a>,

View File

@ -9,11 +9,11 @@ use serde::{Deserialize, Serialize};
use super::{Update, XMLNS};
impl<'a> Transaction<Update<RgpRestoreRequest>> for DomainUpdate<'a> {}
impl<'a> Transaction<Update<RgpRestoreRequest<'a>>> for DomainUpdate<'a> {}
impl<'a> Transaction<Update<RgpRestoreRequest>> for DomainInfo<'a> {}
impl<'a> Transaction<Update<RgpRestoreRequest<'a>>> for DomainInfo<'a> {}
impl Extension for Update<RgpRestoreRequest> {
impl<'a> Extension for Update<RgpRestoreRequest<'a>> {
type Response = Update<RgpRequestResponse>;
}
@ -21,29 +21,27 @@ impl Extension for Update<RgpRestoreRequest> {
/// Type corresponding to the &lt;restore&gt; tag for an rgp restore request
#[derive(Serialize, Debug)]
pub struct RgpRestoreRequestData {
pub struct RgpRestoreRequestData<'a> {
/// The value of the op attribute in the &lt;restore&gt; tag
pub op: String,
pub op: &'a str,
}
#[derive(Serialize, Debug)]
/// Type for EPP XML &lt;check&gt; command for domains
pub struct RgpRestoreRequest {
pub struct RgpRestoreRequest<'a> {
/// XML namespace for the RGP restore extension
#[serde(rename = "xmlns:rgp")]
xmlns: &'static str,
xmlns: &'a str,
/// The object holding the list of domains to be checked
#[serde(rename = "rgp:restore")]
restore: RgpRestoreRequestData,
restore: RgpRestoreRequestData<'a>,
}
impl Default for RgpRestoreRequest {
impl Default for RgpRestoreRequest<'static> {
fn default() -> Self {
Self {
xmlns: XMLNS,
restore: RgpRestoreRequestData {
op: "request".to_string(),
},
restore: RgpRestoreRequestData { op: "request" },
}
}
}

View File

@ -37,7 +37,7 @@ pub struct HostCreateRequestData<'a> {
pub name: StringValue<'a>,
/// The list of IP addresses for the host
#[serde(rename = "host:addr")]
pub addresses: Option<&'a [HostAddr]>,
pub addresses: Option<&'a [HostAddr<'a>]>,
}
#[derive(Serialize, Debug)]

View File

@ -55,10 +55,10 @@ pub struct HostInfoResponseData {
pub roid: StringValue<'static>,
/// The list of host statuses
#[serde(rename = "status")]
pub statuses: Vec<ObjectStatus>,
pub statuses: Vec<ObjectStatus<'static>>,
/// The list of host IP addresses
#[serde(rename = "addr")]
pub addresses: Vec<HostAddr>,
pub addresses: Vec<HostAddr<'static>>,
/// The epp user to whom the host belongs
#[serde(rename = "clID")]
pub client_id: StringValue<'static>,

View File

@ -54,10 +54,10 @@ pub struct HostChangeInfo<'a> {
pub struct HostAddRemove<'a> {
/// The IP addresses to be added to or removed from the host
#[serde(rename = "host:addr")]
pub addresses: Option<&'a [HostAddr]>,
pub addresses: Option<&'a [HostAddr<'a>]>,
/// The statuses to be added to or removed from the host
#[serde(rename = "host:status")]
pub statuses: Option<&'a [ObjectStatus]>,
pub statuses: Option<&'a [ObjectStatus<'a>]>,
}
/// Type for data under the host &lt;update&gt; tag
@ -107,7 +107,7 @@ mod tests {
};
let statuses = &[ObjectStatus {
status: "clientDeleteProhibited".to_string(),
status: "clientDeleteProhibited".into(),
}];
let remove = HostAddRemove {

View File

@ -4,28 +4,28 @@ use crate::common::NoExtension;
use crate::request::{Command, Transaction};
use serde::Serialize;
impl Transaction<NoExtension> for MessageAck {}
impl<'a> Transaction<NoExtension> for MessageAck<'a> {}
impl Command for MessageAck {
impl<'a> Command for MessageAck<'a> {
type Response = String;
const COMMAND: &'static str = "poll";
}
#[derive(Serialize, Debug)]
/// Type for EPP XML &lt;poll&gt; command for message ack
pub struct MessageAck {
pub struct MessageAck<'a> {
/// The type of operation to perform
/// The value is "ack" for message acknowledgement
op: String,
op: &'a str,
/// The ID of the message to be acknowledged
#[serde(rename = "msgID")]
message_id: String,
}
impl MessageAck {
impl<'a> MessageAck<'a> {
pub fn new(message_id: u32) -> Self {
Self {
op: "ack".to_string(),
op: "ack",
message_id: message_id.to_string(),
}
}

View File

@ -2,9 +2,9 @@ use crate::common::{NoExtension, StringValue};
use crate::request::{Command, Transaction};
use serde::{Deserialize, Serialize};
impl Transaction<NoExtension> for MessagePoll {}
impl<'a> Transaction<NoExtension> for MessagePoll<'a> {}
impl Command for MessagePoll {
impl<'a> Command for MessagePoll<'a> {
type Response = MessagePollResponse;
const COMMAND: &'static str = "poll";
}
@ -13,17 +13,15 @@ impl Command for MessagePoll {
#[derive(Serialize, Debug)]
/// Type for EPP XML &lt;poll&gt; command for message poll
pub struct MessagePoll {
pub struct MessagePoll<'a> {
/// The type of operation to perform
/// The value is "req" for message polling
op: String,
op: &'a str,
}
impl Default for MessagePoll {
impl Default for MessagePoll<'static> {
fn default() -> Self {
Self {
op: "req".to_owned(),
}
Self { op: "req" }
}
}