-
My code cannot be compiled with E0423. How do I use wrap in route macro? pub struct GithubTokenValidator {
}
impl Default for GithubTokenValidator {
fn default() -> Self {
Self::new()
}
}
impl<S, B> Transform<S> for GithubTokenValidator ... { ... };
//#[post("/event_handler", wrap="GithubTokenValidator {}")] // says `error: unexpected token`
#[post("/event_handler", wrap="GithubTokenValidator")]
async fn event_handler(ctx: web::Data<AppContext>, body: Bytes, req: HttpRequest) -> Result<impl Responder, Error> {
Ok("")
}
|
Beta Was this translation helpful? Give feedback.
Answered by
anatawa12
May 10, 2021
Replies: 1 comment
-
[Self-solving] I found we can use expressions like |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
anatawa12
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[Self-solving]
I found we can use expressions like
GithubTokenValidator::new()
. However, we can't use expressionsGithubTokenValidator {}