Skip to main content

zvariant_utils/
serialized.rs

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