resp_result/config/
mod.rs

1mod resp;
2mod status_signed;
3
4pub use self::resp::RespConfig;
5pub use self::serde::SerdeConfig;
6pub use self::status_signed::{SignType, StatusSign};
7use self::{resp::InnerRespConfig, serde::InnerSerdeConfig};
8
9mod serde;
10
11/// the config trait that giving for [`set_config`](crate::set_config)
12///
13/// this trait is the sub trait of [`SerdeConfig`] and [`RespConfig`]
14pub trait ConfigTrait: Sync + 'static
15where
16    Self: SerdeConfig,
17    Self: RespConfig,
18{
19}
20
21pub(crate) struct InnerConfig {
22    pub(crate) serde: InnerSerdeConfig,
23    pub(crate) resp: InnerRespConfig,
24}
25
26impl Default for InnerConfig {
27    fn default() -> Self {
28        Self::from_cfg(&DefaultConfig)
29    }
30}
31
32impl InnerConfig {
33    pub(crate) fn from_cfg<C: ConfigTrait>(cfg: &C) -> Self {
34        Self {
35            serde: InnerSerdeConfig::into_inner(cfg),
36            resp: InnerRespConfig::into_inner(cfg),
37        }
38    }
39}
40
41/// config that apply all default config
42pub struct DefaultConfig;
43
44impl SerdeConfig for DefaultConfig {}
45
46impl RespConfig for DefaultConfig {}
47
48impl ConfigTrait for DefaultConfig {}