From f3aab578e7d272142fb1df704e2ecf83190044cf Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Fri, 28 Jan 2022 10:41:53 +0100 Subject: [PATCH] Relax lifetime constraints on command + extension combinations They should not be required to have the same lifetimes. --- src/client.rs | 22 +++++++++++----------- src/extensions/consolidate.rs | 2 +- src/extensions/namestore.rs | 34 +++++++++++++++++----------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/client.rs b/src/client.rs index ca4159a..51264cf 100644 --- a/src/client.rs +++ b/src/client.rs @@ -138,14 +138,14 @@ impl EppClient { Ok(GreetingDocument::deserialize(&response)?.data) } - pub async fn transact<'a, C: 'a, E: 'a>( + pub async fn transact<'c, 'e, C, E>( &mut self, - data: impl Into> + 'a, + data: impl Into>, id: &str, ) -> Result, Error> where - C: Transaction + Command, - E: Extension, + C: Transaction + Command + 'c, + E: Extension + 'e, { let data = data.into(); let epp_xml = >::serialize_request(data.command, data.extension, id)?; @@ -176,13 +176,13 @@ impl EppClient { } } -pub struct RequestData<'a, C, E> { - command: &'a C, - extension: Option<&'a E>, +pub struct RequestData<'c, 'e, C, E> { + command: &'c C, + extension: Option<&'e E>, } -impl<'a, C: Command> From<&'a C> for RequestData<'a, C, NoExtension> { - fn from(command: &'a C) -> Self { +impl<'c, C: Command> From<&'c C> for RequestData<'c, 'static, C, NoExtension> { + fn from(command: &'c C) -> Self { Self { command, extension: None, @@ -190,8 +190,8 @@ impl<'a, C: Command> From<&'a C> for RequestData<'a, C, NoExtension> { } } -impl<'a, C: Command, E: Extension> From<(&'a C, &'a E)> for RequestData<'a, C, E> { - fn from((command, extension): (&'a C, &'a E)) -> Self { +impl<'c, 'e, C: Command, E: Extension> From<(&'c C, &'e E)> for RequestData<'c, 'e, C, E> { + fn from((command, extension): (&'c C, &'e E)) -> Self { Self { command, extension: Some(extension), diff --git a/src/extensions/consolidate.rs b/src/extensions/consolidate.rs index 4954602..333d18e 100644 --- a/src/extensions/consolidate.rs +++ b/src/extensions/consolidate.rs @@ -13,7 +13,7 @@ use super::namestore::{NameStore, NameStoreData}; pub const XMLNS: &str = "http://www.verisign.com/epp/sync-1.0"; -impl<'a> Transaction for DomainUpdate<'a> {} +impl Transaction for DomainUpdate<'_> {} impl Extension for Update { type Response = NoExtension; diff --git a/src/extensions/namestore.rs b/src/extensions/namestore.rs index d3eb7eb..30d500b 100644 --- a/src/extensions/namestore.rs +++ b/src/extensions/namestore.rs @@ -25,29 +25,29 @@ pub const XMLNS: &str = "http://www.verisign-grs.com/epp/namestoreExt-1.1"; // Contact -impl<'a> Transaction> for ContactCheck<'a> {} -impl<'a> Transaction> for ContactCreate<'a> {} -impl<'a> Transaction> for ContactDelete<'a> {} -impl<'a> Transaction> for ContactInfo<'a> {} -impl<'a> Transaction> for ContactUpdate<'a> {} +impl Transaction> for ContactCheck<'_> {} +impl Transaction> for ContactCreate<'_> {} +impl Transaction> for ContactDelete<'_> {} +impl Transaction> for ContactInfo<'_> {} +impl Transaction> for ContactUpdate<'_> {} // Domain -impl<'a> Transaction> for DomainCheck<'a> {} -impl<'a> Transaction> for DomainCreate<'a> {} -impl<'a> Transaction> for DomainDelete<'a> {} -impl<'a> Transaction> for DomainInfo<'a> {} -impl<'a> Transaction> for DomainRenew<'a> {} -impl<'a> Transaction> for DomainTransfer<'a> {} -impl<'a> Transaction> for DomainUpdate<'a> {} +impl Transaction> for DomainCheck<'_> {} +impl Transaction> for DomainCreate<'_> {} +impl Transaction> for DomainDelete<'_> {} +impl Transaction> for DomainInfo<'_> {} +impl Transaction> for DomainRenew<'_> {} +impl Transaction> for DomainTransfer<'_> {} +impl Transaction> for DomainUpdate<'_> {} // Host -impl<'a> Transaction> for HostCheck<'a> {} -impl<'a> Transaction> for HostCreate<'a> {} -impl<'a> Transaction> for HostDelete<'a> {} -impl<'a> Transaction> for HostInfo<'a> {} -impl<'a> Transaction> for HostUpdate<'a> {} +impl Transaction> for HostCheck<'_> {} +impl Transaction> for HostCreate<'_> {} +impl Transaction> for HostDelete<'_> {} +impl Transaction> for HostInfo<'_> {} +impl Transaction> for HostUpdate<'_> {} impl<'a> NameStore<'a> { /// Create a new RGP restore report request