2022-09-23 23:50:50 +02:00
|
|
|
use axum::extract::FromRef;
|
2024-11-26 19:04:01 +01:00
|
|
|
use axum_extra::extract::cookie::{Key, PrivateCookieJar};
|
|
|
|
use axum_macros::FromRequest;
|
2022-09-23 23:50:50 +02:00
|
|
|
|
|
|
|
#[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() {}
|