thcon_trait/
lib.rs

1#![deny(clippy::all)]
2
3use serde::Deserialize;
4
5/// An app that can be disabled via configuration.
6pub trait Disableable {
7    /// Returns `true` if the configured app is disabled.
8    fn disabled(&self) -> bool;
9}
10
11#[derive(Deserialize, Debug)]
12pub struct Disabled {
13    #[serde(default)]
14    disabled: bool,
15}
16
17impl Disableable for Disabled {
18    fn disabled(&self) -> bool {
19        self.disabled
20    }
21}
22
23/// Unused marker trait to enable #[derive(AppConfig)].
24pub trait AppConfig {}