Apart from variable and type declarations, Rust also allows us to define global values that can be accessed from anywhere in the program. They follow the naming convention of every letter being uppercase. These are of two kinds: constants and statics. There are also constant functions, which can be called to initialize these global values. Let's explore constants first.
Global values
Constants
The first form of global values are constants. Here's how we can define one:
// constants.rs
const HEADER: &'static [u8; 4] = b"Obj\0";
fn main() {
println!("{:?}", HEADER);
}
We use the const keyword to create constants. As constants aren't declared with the let keyword, specifying types...