Attribute Macro diplomat::enum_convert

source ·
#[enum_convert]
Expand description

Generate From and Into implementations for a Diplomat enum

This is invoked as #[diplomat::enum_convert(OtherEnumName)] on a Diplomat enum. It will assume the other enum has exactly the same variants and generate From and Into implementations using those. In case that enum is #[non_exhaustive], you may use #[diplomat::enum_convert(OtherEnumName, needs_wildcard)] to generate a panicky wildcard branch. It is up to the library author to ensure the enums are kept in sync. You may use the #[non_exhaustive_omitted_patterns] lint to enforce this.