Skip to content

Commit

Permalink
🎨 Run cargo fmt with nightly rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jokeyrhyme committed Nov 14, 2024
1 parent e89212d commit 2ccd961
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ pub enum Access {
#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
#[serde(try_from = "Document")]
pub struct BusConfig {
/// If `true`, 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.
/// If `true`, 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.
pub allow_anonymous: bool,

/// Lists permitted authorization mechanisms.
Expand All @@ -50,7 +51,8 @@ pub struct BusConfig {
pub keep_umask: bool,

/// 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.
/// The address is in the standard D-Bus format that contains a transport name plus possible
/// parameters/options.
#[serde(default)]
pub listen: HashSet<String>,

Expand All @@ -60,7 +62,8 @@ pub struct BusConfig {
pub policies: Vec<Policy>,

/// 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.
/// which tell the dbus-daemon how to start a program to provide a particular well-known bus
/// name.
#[serde(default)]
pub servicedir: Vec<PathBuf>,

Expand All @@ -70,7 +73,8 @@ pub struct BusConfig {
/// If `true`, the bus daemon will log to syslog.
pub syslog: bool,

/// This element only controls which message bus specific environment variables are set in activated clients.
/// This element only controls which message bus specific environment variables are set in
/// activated clients.
pub r#type: Option<BusType>,

/// The user account the daemon should run as, as either a username or a UID.
Expand Down Expand Up @@ -110,7 +114,8 @@ impl TryFrom<Document> for BusConfig {
}
Element::Servicehelper(p) => {
// NOTE: we're assuming this has the same "last one wins" behaviour as `<type>`
// TODO: warn and then ignore if we aren't reading: /usr/share/dbus-1/system.conf
// TODO: warn and then ignore if we aren't reading:
// /usr/share/dbus-1/system.conf
bc.servicehelper = Some(p);
}
Element::StandardSessionServicedirs => {
Expand All @@ -122,7 +127,8 @@ impl TryFrom<Document> for BusConfig {
}
Element::StandardSystemServicedirs => {
// NOTE: because servicedir sequence is important, we cannot de-duplicate this
// TODO: warn and then ignore if we aren't reading: /usr/share/dbus-1/system.conf
// TODO: warn and then ignore if we aren't reading:
// /usr/share/dbus-1/system.conf
bc.servicedir
.extend(STANDARD_SYSTEM_SERVICEDIRS.iter().map(PathBuf::from));
}
Expand Down Expand Up @@ -240,10 +246,12 @@ impl BusConfig {
#[serde(rename_all = "lowercase")]
pub enum BusType {
/// The DBUS_STARTER_BUS_TYPE environment variable will be set to "session",
/// and the DBUS_SESSION_BUS_ADDRESS environment variable will be set to the address of the session bus.
/// and the DBUS_SESSION_BUS_ADDRESS environment variable will be set to the address of the
/// session bus.
Session,
/// The DBUS_STARTER_BUS_TYPE environment variable will be set to "system",
/// and the DBUS_SYSTEM_BUS_ADDRESS environment variable will be set to the address of the system bus.
/// and the DBUS_SYSTEM_BUS_ADDRESS environment variable will be set to the address of the
/// system bus.
System,
}

Expand All @@ -260,18 +268,20 @@ enum Element {
Auth(String),
Fork,
KeepUmask,
// TODO: support `<include ignore_missing=(yes|no) if_selinux_enabled=(yes|no) selinux_root_relative=(yes|no)>`
// TODO: support `<includedir>`
// TODO: support `<include ignore_missing=(yes|no) if_selinux_enabled=(yes|no)
// selinux_root_relative=(yes|no)>` TODO: support `<includedir>`
Listen(String),
Limit,
Pidfile(PathBuf),
Policy(PolicyElement),
Servicedir(PathBuf),
Servicehelper(PathBuf),
/// Requests a standard set of session service directories.
/// Its effect is similar to specifying a series of <servicedir/> elements for each of the data directories, in the order given here.
/// Its effect is similar to specifying a series of <servicedir/> elements for each of the data
/// directories, in the order given here.
StandardSessionServicedirs,
/// Specifies the standard system-wide activation directories that should be searched for service files.
/// Specifies the standard system-wide activation directories that should be searched for
/// service files.
StandardSystemServicedirs,
Syslog,
Type(TypeElement),
Expand Down

0 comments on commit 2ccd961

Please sign in to comment.