api: Remove NonAuthRequest traits
This commit is contained in:
parent
1989e0350d
commit
c9bd9bf00b
@ -373,12 +373,6 @@ pub trait EndpointError: OutgoingResponse + StdError + Sized + Send + 'static {
|
|||||||
) -> Result<Self, error::DeserializationError>;
|
) -> Result<Self, error::DeserializationError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marker trait for requests that don't require authentication, for the client side.
|
|
||||||
pub trait OutgoingNonAuthRequest: OutgoingRequest {}
|
|
||||||
|
|
||||||
/// Marker trait for requests that don't require authentication, for the server side.
|
|
||||||
pub trait IncomingNonAuthRequest: IncomingRequest {}
|
|
||||||
|
|
||||||
/// Authentication scheme used by the endpoint.
|
/// Authentication scheme used by the endpoint.
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
#[allow(clippy::exhaustive_enums)]
|
#[allow(clippy::exhaustive_enums)]
|
||||||
|
@ -3,7 +3,6 @@ use quote::quote;
|
|||||||
use syn::Field;
|
use syn::Field;
|
||||||
|
|
||||||
use super::{Request, RequestField};
|
use super::{Request, RequestField};
|
||||||
use crate::api::auth_scheme::AuthScheme;
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
pub fn expand_incoming(&self, ruma_common: &TokenStream) -> TokenStream {
|
pub fn expand_incoming(&self, ruma_common: &TokenStream) -> TokenStream {
|
||||||
@ -175,14 +174,6 @@ impl Request {
|
|||||||
vars(self.body_fields(), quote! { request_body })
|
vars(self.body_fields(), quote! { request_body })
|
||||||
};
|
};
|
||||||
|
|
||||||
let non_auth_impl = matches!(self.authentication, AuthScheme::None(_)).then(|| {
|
|
||||||
quote! {
|
|
||||||
#[automatically_derived]
|
|
||||||
#[cfg(feature = "server")]
|
|
||||||
impl #ruma_common::api::IncomingNonAuthRequest for #incoming_request_type {}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#[cfg(feature = "server")]
|
#[cfg(feature = "server")]
|
||||||
@ -222,8 +213,6 @@ impl Request {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#non_auth_impl
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,15 +140,6 @@ impl Request {
|
|||||||
|
|
||||||
let (impl_generics, ty_generics, where_clause) = self.generics.split_for_impl();
|
let (impl_generics, ty_generics, where_clause) = self.generics.split_for_impl();
|
||||||
|
|
||||||
let non_auth_impl = matches!(self.authentication, AuthScheme::None(_)).then(|| {
|
|
||||||
quote! {
|
|
||||||
#[automatically_derived]
|
|
||||||
#[cfg(feature = "client")]
|
|
||||||
impl #impl_generics #ruma_common::api::OutgoingNonAuthRequest
|
|
||||||
for Request #ty_generics #where_clause {}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
#[cfg(feature = "client")]
|
#[cfg(feature = "client")]
|
||||||
@ -182,8 +173,6 @@ impl Request {
|
|||||||
Ok(http_request)
|
Ok(http_request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#non_auth_impl
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user