-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Labels
Description
I have an enum that already has a pub const fn as_str(&self) -> &str function. I want to reuse it for both Display and Debug implementations.
I have no problem doing just that with derive_more::Display, but for some reason the Debug counterpart error out:
#[derive(PartialOrd, Ord, PartialEq, Eq, Clone, Copy, derive_more::Debug, derive_more::Display)]
#[display("{}", self.as_str())]
#[debug("{}", self)] // <-- #[debug("...", ...)]` attribute is not allowed on enum, place it on its variants instead
pub enum DeviceType {
Telescope,
Camera,
// ...
}This seems like an artificial limitation - I assume there's no technical reason for debug() attribute behaving differently than display()?