dbus_server_address_parser/encode/
autolaunch.rs

1#[cfg(target_family = "windows")]
2use super::escape::escape;
3use super::guid::to_guid;
4use crate::Autolaunch;
5use std::fmt::{Display, Formatter, Result as FmtResult};
6
7impl Display for Autolaunch {
8    #[cfg(target_family = "windows")]
9    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
10        write!(f, "autolaunch:")?;
11        let mut not_first = false;
12        if let Some(scope) = &self.scope {
13            write!(f, "scope={}", escape(scope))?;
14            not_first = true;
15        }
16        if let Some(guid) = &self.guid {
17            if not_first {
18                write!(f, ",")?;
19            }
20            write!(f, "guid={}", to_guid(guid))
21        } else {
22            Ok(())
23        }
24    }
25
26    #[cfg(target_family = "unix")]
27    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
28        write!(f, "autolaunch:")?;
29        if let Some(guid) = &self.guid {
30            write!(f, "guid={}", to_guid(guid))
31        } else {
32            Ok(())
33        }
34    }
35}