1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Allows extracting app state.
use Infallible;
use async_trait;
use ;
use crate::;
/// `State` is an extractor helper struct that allows you to extract app state from the state type added in `App::new`.
///
/// This implements `Deref` and `DerefMut` to the inner type, but the inner type is also public so you can also just take ownership if you prefer.
///
/// Any type that implements `From<&S>` where `S` is the app state given in `App::new` can be extracted via this type.
/// These `From` implementations can be derived on a struct via `kanin::AppState`.
///
/// # Example
/// ```
/// # use kanin::{AppState, extract::State};
/// #[derive(AppState)]
/// struct AppState {
/// num: u8,
/// }
/// async fn my_handler(State(num): State<u8>) {
/// assert_eq!(42, num);
/// }
/// ```
;
/// Extract implementation for app state.