-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve error message when auth data is missing clone impl
- Loading branch information
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use gotham_restful::*; | ||
use serde::Deserialize; | ||
|
||
#[derive(Resource)] | ||
#[resource(read_all)] | ||
struct FooResource; | ||
|
||
#[derive(Deserialize)] | ||
struct AuthData { | ||
iat: u64, | ||
exp: u64 | ||
} | ||
|
||
#[read_all] | ||
async fn read_all(auth: AuthStatus<AuthData>) -> Result<NoContent, AuthError> { | ||
auth.ok()?; | ||
Ok(NoContent::default()) | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error[E0277]: the trait bound `AuthData: Clone` is not satisfied | ||
--> $DIR/auth_data_non_clone.rs:15:25 | ||
| | ||
15 | async fn read_all(auth: AuthStatus<AuthData>) -> Result<NoContent, AuthError> { | ||
| ^^^^^^^^^^ the trait `Clone` is not implemented for `AuthData` | ||
| | ||
= note: required because of the requirements on the impl of `Clone` for `gotham_restful::AuthStatus<AuthData>` | ||
= note: required by `clone` |