You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IntoStaticStr cannot be used inside const functions. It would be nice if there were a derive macro for this that could be used with const. For example:
use std::borrow::Cow;use strum_macros::AsStaticStr;#[derive(AsStaticStr)]pubenumThing{Foo,Bar}pubconstFOO:&'static str = Thing::Foo.as_static_str();// Or inside a const function which is more usefulpubstructThingString(Cow<'static,str>);implThingString{pubconstfnnew(thing:Thing) -> Self{Self(Cow::Borrowed(thing.as_static_str()))}}pubconstFOO_STRING:ThingString = ThingString::new(Thing::FOO);
The text was updated successfully, but these errors were encountered:
IntoStaticStr
cannot be used inside const functions. It would be nice if there were a derive macro for this that could be used with const. For example:The text was updated successfully, but these errors were encountered: