scuffle_bootstrap/
config.rs1pub trait ConfigParser: Sized {
14 fn parse() -> impl std::future::Future<Output = anyhow::Result<Self>>;
16}
17
18impl ConfigParser for () {
19 #[inline(always)]
20 fn parse() -> impl std::future::Future<Output = anyhow::Result<Self>> {
21 std::future::ready(Ok(()))
22 }
23}
24
25pub struct EmptyConfig;
27
28impl ConfigParser for EmptyConfig {
29 #[inline(always)]
30 fn parse() -> impl std::future::Future<Output = anyhow::Result<Self>> {
31 std::future::ready(Ok(EmptyConfig))
32 }
33}
34
35#[cfg(test)]
36#[cfg_attr(all(test, coverage_nightly), coverage(off))]
37mod tests {
38 use super::{ConfigParser, EmptyConfig};
39
40 #[tokio::test]
41 async fn unit_config() {
42 assert!(matches!(<()>::parse().await, Ok(())));
43 }
44
45 #[tokio::test]
46 async fn empty_config() {
47 assert!(matches!(EmptyConfig::parse().await, Ok(EmptyConfig)));
48 }
49}