// if you need a constant global variable use const // remember to uppercase the variable name const IP_ADDRESS: &'static str = "8.8.8.8" // if you need it to be mutable use static static IP_ADDRESS: &str = "8.8.8.8"static SOME_INT: i32 = 5; static SOME_STR: &'static str = "A static string"; static SOME_STRUCT: MyStruct = MyStruct { number: 10, string: "Some string", }; static mut db: Option<sqlite::Connection> = None; fn main() { println!("{}", SOME_INT); println!("{}", SOME_STR); println!("{}", SOME_STRUCT.number); println!("{}", SOME_STRUCT.string); unsafe { db = Some(open_database()); } } struct MyStruct { number: i32, string: &'static str, } /* Note: The initial access to the static mut has to be unsafe. */