Derive Macro zbus_macros::DBusError

source ·
    // Attributes available to this derive:
Expand description

Derive macro for implementing zbus::DBusError trait.

This macro makes it easy to implement the zbus::DBusError trait for your custom error type (currently only enums are supported).

If a special variant marked with the zbus attribute is present, From<zbus::Error> is also implemented for your type. This variant can only have a single unnamed field of type zbus::Error. This implementation makes it possible for you to declare proxy methods to directly return this type, rather than zbus::Error.

Each variant (except for the special zbus one) can optionally have a (named or unnamed) String field (which is used as the human-readable error description).


use zbus_macros::DBusError;

#[derive(DBusError, Debug)]
#[zbus(prefix = "org.myservice.App")]
enum Error {