> This could be tricky, since Rust enum variants can contain data. But if none of the variants contain data, it would be easy to make a method that returns a Result<MyEnum, CustomParseError>
Usually when you want to convert a string to an enum, you're trying to build some kind of parser or deserialization library, in which nom or serde are the best choices. (Of course, C++ has several parser frameworks too.)