Skip to content

Commit

Permalink
➖ Drop serde-query
Browse files Browse the repository at this point in the history
serde-query simplifies the parsing of nested XML structures, but makes it harder to implement other features like "last `<type`>
  • Loading branch information
jokeyrhyme authored and zeenix committed Nov 27, 2024
1 parent 0de36be commit b331a0c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 108 deletions.
95 changes: 0 additions & 95 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ console-subscriber = { version = "0.4.0", optional = true }
xdg-home = "1.1.0"
event-listener = "5.3.0"
quick-xml = { version = "0.36.2", features = ["overlapped-lists", "serialize"] }
serde-query = { version = "0.2.0", features = ["derive"] }

[target.'cfg(unix)'.dependencies]
nix = { version = "0.29.0", features = ["user"] }
Expand Down
13 changes: 1 addition & 12 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{collections::HashSet, path::PathBuf};
use anyhow::{Error, Result};
use quick_xml::{events::Event, Reader};
use serde::Deserialize;
use serde_query::DeserializeQuery;

mod transform;

Expand All @@ -19,62 +18,52 @@ const EXPECTED_DOCTYPE_PARTS: &[&str] = &[
];

/// implements [`dbus-daemon`'s Configuration File](https://dbus.freedesktop.org/doc/dbus-daemon.1.html#configuration_file)
#[derive(Clone, Debug, Default, Deserialize, DeserializeQuery, PartialEq)]
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
pub struct BusConfig {
/// If `Some`, connections that authenticated using the ANONYMOUS mechanism will be authorized to connect.
/// This option has no practical effect unless the ANONYMOUS mechanism has also been enabled using the `auth` option.
#[query(".allow_anonymous")]
// TODO: consider finding a way to make this `bool` instead of `Option<()>`
pub allow_anonymous: Option<()>,

/// Lists permitted authorization mechanisms.
/// If this element doesn't exist, then all known mechanisms are allowed.
/// If there are multiple <auth> elements, all the listed mechanisms are allowed.
#[query(r#".auth.[].["$value"]"#)]
#[serde(default)]
// TODO: if there is a fixed set of possible values, consider using an `enum`
pub auth: HashSet<String>,

/// If `Some`, the bus daemon becomes a real daemon (forks into the background, etc.).
#[query(".fork")]
// TODO: consider finding a way to make this `bool` instead of `Option<()>`
pub fork: Option<()>,

/// If `Some`, the bus daemon keeps its original umask when forking.
/// This may be useful to avoid affecting the behavior of child processes.
#[query(".keep_umask")]
// TODO: consider finding a way to make this `bool` instead of `Option<()>`
pub keep_umask: Option<()>,

/// Address(es) that the bus should listen on.
/// The address is in the standard D-Bus format that contains a transport name plus possible parameters/options.
#[query(".listen")]
#[serde(default)]
pub listen: Vec<String>,

/// The bus daemon will write its pid to the specified file.
#[query(".pidfile")]
pub pidfile: Option<PathBuf>,

/// 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<PathBuf>,

/// If `Some`, the bus daemon will log to syslog.
#[query(".syslog")]
// TODO: consider finding a way to make this `bool` instead of `Option<()>`
pub syslog: Option<()>,

/// This element only controls which message bus specific environment variables are set in activated clients.
#[query(".type")]
pub r#type: Option<Type>,

/// The user account the daemon should run as, as either a username or a UID.
/// If the daemon cannot change to this UID on startup, it will exit.
/// If this element is not present, the daemon will not change or care about its UID.
#[query(".user")]
pub user: Option<String>,
}

Expand Down

0 comments on commit b331a0c

Please sign in to comment.