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)
}
pub async fn transact<'a, C: 'a, E: 'a>(
pub async fn transact<'c, 'e, C, E>(
&mut self,
data: impl Into<RequestData<'a, C, E>> + 'a,
data: impl Into<RequestData<'c, 'e, C, E>>,
id: &str,
) -> Result<Response<C::Response, E::Response>, Error>
where
C: Transaction<E> + Command,
E: Extension,
C: Transaction<E> + Command + 'c,
E: Extension + 'e,
{
let data = data.into();
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> {
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),

View File

@ -13,7 +13,7 @@ use super::namestore::{NameStore, NameStoreData};
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 {
type Response = NoExtension;

View File

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