From bcea20034affd2059b683caf0e80d58b94438434 Mon Sep 17 00:00:00 2001 From: Ron Waldon-Howe Date: Sun, 27 Oct 2024 15:22:59 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=BA=20Support=20``=20eleme?= =?UTF-8?q?nts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/config.rs b/src/config.rs index 6edbd8f..5d9a3bf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -56,6 +56,12 @@ pub struct BusConfig { #[query(".pidfile")] pub pidfile: Option, + /// Adds a directory to search for .service files, + /// which tell the dbus-daemon how to start a program to provide a particular well-known bus name. + #[query(".servicedir")] + #[serde(default)] + pub servicedir: Vec, + /// If `Some`, the bus daemon will log to syslog. #[query(".syslog")] // TODO: consider finding a way to make this `bool` instead of `Option<()>` @@ -270,6 +276,27 @@ mod tests { ); } + #[test] + fn bus_config_parse_with_servicedir_ok() { + let input = r#" + + /example + /anotherexample + + "#; + + let busconfig = BusConfig::parse(input).expect("should parse XML input"); + + assert_eq!( + busconfig, + BusConfig { + servicedir: vec![PathBuf::from("/example"), PathBuf::from("/anotherexample"),], + ..Default::default() + } + ); + } + #[test] fn bus_config_parse_with_type_ok() { let input = r#"