1

I need to have a static std::string::String . I tried initializing it in several ways but in vain. One of them being -

static mut DURATION_HEX:String = "0".to_string();

I get a note saying :

note: a limited form of compile-time function evaluation is available on a nightly compiler via const fn

I am not able to initialize it. I cannot leave it without initialization as well. How do I create a static variable of non-primitive type in rust?

Rajeev Ranjan
  • 3,588
  • 6
  • 28
  • 52

0 Answers0