1use static_assertions::assert_impl_all;
2
3/// The encoding format.
4#[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
5pub enum Format {
6 /// [D-Bus](https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling)
7 /// format.
8 #[default]
9 DBus,
10 /// [GVariant](https://developer.gnome.org/glib/stable/glib-GVariant.html) format.
11 #[cfg(feature = "gvariant")]
12 GVariant,
13}
14
15assert_impl_all!(Format: Send, Sync, Unpin);
16
17impl std::fmt::Display for Format {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 match self {
20 Format::DBus => write!(f, "D-Bus"),
21 #[cfg(feature = "gvariant")]
22 Format::GVariant => write!(f, "GVariant"),
23 }
24 }
25}
26