use salvo::prelude::*;
use salvo::session::{CookieStore, Session, SessionDepotExt, SessionHandler};
let session_handler = SessionHandler::builder(
CookieStore::new(),
b"secretabsecretabsecretabsecretabsecretabsecretabsecretabsecretab",
);
Router::new()
.hoop(Logger::new())
.hoop(CatchPanic::new())
.hoop(session_handler)
这里会报错 .hoop(session_handler)
error[E0277]: the trait bound `HandlerBuilder<salvo::salvo_session::CookieStore>: Handler` is not satisfied
--> src/bin/web.rs:41:15
41
.hoop(session_handler)
---- ^^^^^^^^^^^^^^^ the trait Handler is not implemented for HandlerBuilder<salvo::salvo_session::CookieStore>
required by a bound introduced by this call
= help: the following other types implement trait `Handler`:
(A, B)
(A, B, C)
(A, B, C, D)
(A, B, C, D, E)
(A, B, C, D, E, F)
(A, B, C, D, E, F, G)
(A, B, C, D, E, F, G, H)
(A,)
and 41 others
note: required by a bound in salvo::Router::hoop
--> /Users/matt/.cargo/git/checkouts/salvo-7f211b7208170219/2b65ccc/crates/core/src/routing/router.rs:161:20
Handler
is not implemented forHandlerBuilder<salvo::salvo_session::CookieStore>
note: required by a bound in
salvo::Router::hoop
--> /Users/matt/.cargo/git/checkouts/salvo-7f211b7208170219/2b65ccc/crates/core/src/routing/router.rs:161:20cargo.toml salvo = { git = "https://github.com/salvo-rs/salvo", branch = "main", features = [ "full", ] }