oa_gateway/config/
loopback.rs

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
//! `[loopback]` section: the in-process adapter with no socket.

use serde::Deserialize;

use super::default_true;

/// Loopback adapter settings.
///
/// Off when the section is omitted. A present `[loopback]` table turns
/// it on unless `enabled = false`.
#[derive(Debug, Deserialize)]
#[serde(deny_unknown_fields)]
pub(crate) struct LoopbackSection {
    /// Whether to spawn the adapter. `true` when the section is present.
    #[serde(default = "default_true")]
    pub(crate) enabled: bool,
    /// Engine adapter id. Defaults to `"loopback"`.
    #[serde(default = "default_loopback_id")]
    pub(crate) id: String,
}

impl Default for LoopbackSection {
    fn default() -> Self {
        Self {
            enabled: false,
            id: default_loopback_id(),
        }
    }
}

fn default_loopback_id() -> String {
    "loopback".into()
}