How to save global state in rust?


#1

For example, i have some regex that is compiled for better performance, everytime i call a given func i want to use the compiled regex and not compile every time i call a func.

There is any way to do this with rust!?


#2

nevermind… https://doc.rust-lang.org/book/const-and-static.html


#3

You may want to take a look at lazy_static for non-const values.