Currently, the strum library does not support converting enum variants into static strings within a const context. This limitation arises because the library uses the From trait, which cannot have const methods, even in nightly Rust. This issue becomes particularly significant when attempting to use concatcp to concatenate two static strings in a const context.
To address this limitation, I propose the addition of a new enum meta attribute, const_into_str. This attribute would enable generating an additional public const function for enums, allowing conversion to static strings in a const context.
This enhancement would greatly improve strum's functionality by allowing more flexible and performant use of enums in constant expressions. I have prepared an implementation and will submit a pull request for review.
Currently, the
strum
library does not support converting enum variants into static strings within a const context. This limitation arises because the library uses theFrom
trait, which cannot have const methods, even in nightly Rust. This issue becomes particularly significant when attempting to use concatcp to concatenate two static strings in a const context.To address this limitation, I propose the addition of a new enum meta attribute,
const_into_str
. This attribute would enable generating an additional public const function for enums, allowing conversion to static strings in a const context.This enhancement would greatly improve
strum
's functionality by allowing more flexible and performant use of enums in constant expressions. I have prepared an implementation and will submit a pull request for review.