Skip to content

Instantly share code, notes, and snippets.

@kriogenia
Last active June 2, 2023 10:40
Show Gist options
  • Save kriogenia/d9cc1b6bd71f99d4a371329074beb321 to your computer and use it in GitHub Desktop.
Save kriogenia/d9cc1b6bd71f99d4a371329074beb321 to your computer and use it in GitHub Desktop.
Attempt to define as constant a non-const
const ADDRESSES: Vec<&str> = Vec::from([
"http://validaddress.com",
"http://mainmirror.com",
"http://128.0.0.1:1337"
]);
fn main() {
check_addresses()
}
fn check_addresses() {
assert_eq!("http://validaddress.com", ADDRESSES[0]);
println!("The address list is readable and correct: {:?}", ADDRESSES)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment