Relax lifetime constraints on command + extension combinations

They should not be required to have the same lifetimes.
This commit is contained in:
Dirkjan Ochtman 2022-01-28 10:41:53 +01:00 committed by masalachai
parent 2639ec8c95
commit f3aab578e7
3 changed files with 29 additions and 29 deletions

View File

@ -138,14 +138,14 @@ impl<IO: AsyncRead + AsyncWrite + Unpin> EppClient<IO> {
Ok(GreetingDocument::deserialize(&response)?.data) Ok(GreetingDocument::deserialize(&response)?.data)
} }
pub async fn transact<'a, C: 'a, E: 'a>( pub async fn transact<'c, 'e, C, E>(
&mut self, &mut self,
data: impl Into<RequestData<'a, C, E>> + 'a, data: impl Into<RequestData<'c, 'e, C, E>>,
id: &str, id: &str,
) -> Result<Response<C::Response, E::Response>, Error> ) -> Result<Response<C::Response, E::Response>, Error>
where where
C: Transaction<E> + Command, C: Transaction<E> + Command + 'c,
E: Extension, E: Extension + 'e,
{ {
let data = data.into(); let data = data.into();
let epp_xml = <C as Transaction<E>>::serialize_request(data.command, data.extension, id)?; let epp_xml = <C as Transaction<E>>::serialize_request(data.command, data.extension, id)?;
@ -176,13 +176,13 @@ impl<IO: AsyncRead + AsyncWrite + Unpin> EppClient<IO> {
} }
} }
pub struct RequestData<'a, C, E> { pub struct RequestData<'c, 'e, C, E> {
command: &'a C, command: &'c C,
extension: Option<&'a E>, extension: Option<&'e E>,
} }
impl<'a, C: Command> From<&'a C> for RequestData<'a, C, NoExtension> { impl<'c, C: Command> From<&'c C> for RequestData<'c, 'static, C, NoExtension> {
fn from(command: &'a C) -> Self { fn from(command: &'c C) -> Self {
Self { Self {
command, command,
extension: None, 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> { impl<'c, 'e, C: Command, E: Extension> From<(&'c C, &'e E)> for RequestData<'c, 'e, C, E> {
fn from((command, extension): (&'a C, &'a E)) -> Self { fn from((command, extension): (&'c C, &'e E)) -> Self {
Self { Self {
command, command,
extension: Some(extension), extension: Some(extension),

View File

@ -13,7 +13,7 @@ use super::namestore::{NameStore, NameStoreData};
pub const XMLNS: &str = "http://www.verisign.com/epp/sync-1.0"; pub const XMLNS: &str = "http://www.verisign.com/epp/sync-1.0";
impl<'a> Transaction<Update> for DomainUpdate<'a> {} impl Transaction<Update> for DomainUpdate<'_> {}
impl Extension for Update { impl Extension for Update {
type Response = NoExtension; type Response = NoExtension;

View File

@ -25,29 +25,29 @@ pub const XMLNS: &str = "http://www.verisign-grs.com/epp/namestoreExt-1.1";
// Contact // Contact
impl<'a> Transaction<NameStore<'a>> for ContactCheck<'a> {} impl Transaction<NameStore<'_>> for ContactCheck<'_> {}
impl<'a> Transaction<NameStore<'a>> for ContactCreate<'a> {} impl Transaction<NameStore<'_>> for ContactCreate<'_> {}
impl<'a> Transaction<NameStore<'a>> for ContactDelete<'a> {} impl Transaction<NameStore<'_>> for ContactDelete<'_> {}
impl<'a> Transaction<NameStore<'a>> for ContactInfo<'a> {} impl Transaction<NameStore<'_>> for ContactInfo<'_> {}
impl<'a> Transaction<NameStore<'a>> for ContactUpdate<'a> {} impl Transaction<NameStore<'_>> for ContactUpdate<'_> {}
// Domain // Domain
impl<'a> Transaction<NameStore<'a>> for DomainCheck<'a> {} impl Transaction<NameStore<'_>> for DomainCheck<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainCreate<'a> {} impl Transaction<NameStore<'_>> for DomainCreate<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainDelete<'a> {} impl Transaction<NameStore<'_>> for DomainDelete<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainInfo<'a> {} impl Transaction<NameStore<'_>> for DomainInfo<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainRenew<'a> {} impl Transaction<NameStore<'_>> for DomainRenew<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainTransfer<'a> {} impl Transaction<NameStore<'_>> for DomainTransfer<'_> {}
impl<'a> Transaction<NameStore<'a>> for DomainUpdate<'a> {} impl Transaction<NameStore<'_>> for DomainUpdate<'_> {}
// Host // Host
impl<'a> Transaction<NameStore<'a>> for HostCheck<'a> {} impl Transaction<NameStore<'_>> for HostCheck<'_> {}
impl<'a> Transaction<NameStore<'a>> for HostCreate<'a> {} impl Transaction<NameStore<'_>> for HostCreate<'_> {}
impl<'a> Transaction<NameStore<'a>> for HostDelete<'a> {} impl Transaction<NameStore<'_>> for HostDelete<'_> {}
impl<'a> Transaction<NameStore<'a>> for HostInfo<'a> {} impl Transaction<NameStore<'_>> for HostInfo<'_> {}
impl<'a> Transaction<NameStore<'a>> for HostUpdate<'a> {} impl Transaction<NameStore<'_>> for HostUpdate<'_> {}
impl<'a> NameStore<'a> { impl<'a> NameStore<'a> {
/// Create a new RGP restore report request /// Create a new RGP restore report request