2022-09-23 23:50:50 +02:00
|
|
|
use axum_macros::FromRequest;
|
|
|
|
use axum::extract::FromRef;
|
|
|
|
use axum_extra::extract::cookie::{PrivateCookieJar, Key};
|
|
|
|
|
|
|
|
#[derive(FromRequest)]
|
|
|
|
#[from_request(state(AppState))]
|
|
|
|
struct Extractor {
|
|
|
|
cookies: PrivateCookieJar,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct AppState {
|
|
|
|
key: Key,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl FromRef<AppState> for Key {
|
|
|
|
fn from_ref(input: &AppState) -> Self {
|
|
|
|
input.key.clone()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assert_from_request()
|
|
|
|
where
|
2023-03-12 16:37:32 +01:00
|
|
|
Extractor: axum::extract::FromRequest<AppState, Rejection = axum::response::Response>,
|
2022-09-23 23:50:50 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|