rsiot/components_config/http_server/
config.rs

1use crate::message::MsgDataBound;
2
3use super::{GetEndpoint, PutEndpoint};
4
5/// Конфигурация компонента http-server
6#[derive(Clone, Debug)]
7pub struct Config<TMsg>
8where
9    TMsg: MsgDataBound,
10{
11    /// Порт, через который доступен сервер
12    pub port: u16,
13
14    /// Конфигурация точек GET
15    pub get_endpoints: Vec<Box<dyn GetEndpoint<TMsg>>>,
16
17    /// Конфигурация точек PUT
18    pub put_endpoints: Vec<Box<dyn PutEndpoint<TMsg>>>,
19}
20
21#[cfg(test)]
22mod tests {
23    use super::Config;
24    use crate::message::example_message::*;
25
26    #[allow(clippy::no_effect)]
27    #[test]
28    fn stub() {
29        Config::<Custom> {
30            port: 8000,
31            get_endpoints: vec![],
32            put_endpoints: vec![],
33        };
34    }
35
36    #[allow(clippy::no_effect)]
37    #[test]
38    fn fn_input_json() {
39        Config::<Custom> {
40            port: 8000,
41            get_endpoints: vec![],
42            put_endpoints: vec![],
43        };
44    }
45
46    #[allow(clippy::no_effect)]
47    #[test]
48    fn fn_output_json() {
49        Config::<Custom> {
50            port: 8000,
51            get_endpoints: vec![],
52            put_endpoints: vec![],
53        };
54    }
55}