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