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
use std::fmt::Debug;
pub trait HandlerOption: Default {
type Options: HandlerOptions<OptionItem=Self>;
}
pub trait HandlerOptions: Default + Clone + Debug {
type OptionItem: HandlerOption<Options=Self>;
fn update(&mut self, option: Self::OptionItem);
}
pub trait HttpOption<'a, R>: HandlerOption {
type RequestHandler;
fn request_handler(options: Self::Options) -> Self::RequestHandler;
}
pub trait WebSocketOption<H>: HandlerOption {
type WebSocketHandler;
fn websocket_handler(handler: H, options: Self::Options) -> Self::WebSocketHandler;
}