mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-23 04:52:28 +00:00
derive: AuthStatus<T> needs T to always be Clone
This commit is contained in:
parent
342fd2a647
commit
6e9d8bd158
2 changed files with 2 additions and 10 deletions
|
@ -127,7 +127,7 @@ simply add it to your pipeline and request it inside your handler:
|
||||||
#[rest_resource(read_all)]
|
#[rest_resource(read_all)]
|
||||||
struct AuthResource;
|
struct AuthResource;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
struct AuthData {
|
struct AuthData {
|
||||||
sub: String,
|
sub: String,
|
||||||
exp: u64
|
exp: u64
|
||||||
|
|
|
@ -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>
|
fn quote_ty(&self) -> Option<TokenStream2>
|
||||||
{
|
{
|
||||||
match self {
|
match self {
|
||||||
|
@ -275,7 +267,7 @@ pub fn expand_method(method : Method, attrs : TokenStream, item : TokenStream) -
|
||||||
|
|
||||||
// prepare the where clause
|
// prepare the where clause
|
||||||
let mut where_clause = quote!(#resource_ident : #krate::Resource,);
|
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();
|
let auth_ty = arg.ty.quote_ty();
|
||||||
where_clause = quote!(#where_clause #auth_ty : Clone,);
|
where_clause = quote!(#where_clause #auth_ty : Clone,);
|
||||||
|
|
Loading…
Add table
Reference in a new issue