1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-02-22 20:52:27 +00:00

derive: AuthStatus<T> needs T to always be Clone

This commit is contained in:
Dominic 2020-01-25 14:04:26 +01:00
parent 342fd2a647
commit 6e9d8bd158
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 2 additions and 10 deletions

View file

@ -127,7 +127,7 @@ simply add it to your pipeline and request it inside your handler:
#[rest_resource(read_all)]
struct AuthResource;
#[derive(Debug, Deserialize)]
#[derive(Debug, Deserialize, Clone)]
struct AuthData {
sub: String,
exp: u64

View file

@ -122,14 +122,6 @@ impl MethodArgumentType
}
}
fn is_auth_status_ref(&self) -> bool
{
match self {
Self::AuthStatusRef(_) => true,
_ => false
}
}
fn quote_ty(&self) -> Option<TokenStream2>
{
match self {
@ -275,7 +267,7 @@ pub fn expand_method(method : Method, attrs : TokenStream, item : TokenStream) -
// prepare the where clause
let mut where_clause = quote!(#resource_ident : #krate::Resource,);
for arg in args.iter().filter(|arg| (*arg).ty.is_auth_status() && !(*arg).ty.is_auth_status_ref())
for arg in args.iter().filter(|arg| (*arg).ty.is_auth_status())
{
let auth_ty = arg.ty.quote_ty();
where_clause = quote!(#where_clause #auth_ty : Clone,);