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
/// An extractor that allows the given state to be extracted. This lets you inject and
/// extract "last mile" state into your handlers, freeing you up to model your application
/// without fully knowing how it will interact with the outside world.
///
/// State requires that the given state type is cloneable, because it will clone the state
/// when extracting it, for every handler invocation or extractor that uses it.
///
/// # Example
///
/// ```rust
/// use occult::{Extractor, Handler};
///
/// struct ArbitraryState;
///
/// async fn handler(State(state): State<ArbitraryState>) -> String {
/// format!("Hello, world!")
/// }
///
/// #[tokio::main]
/// async fn main() {
/// let state = ArbitraryState;
///
/// let response = handler.invoke((), state).await.unwrap();
/// assert_eq!(response, "Hello, world!");
/// }
/// ```
///
;