Skip to content

Instantly share code, notes, and snippets.

Created January 24, 2020 16:02
What would you like to do?
Code shared from the Rust Playground
use lazy_static; // 1.4.0
use std::collections::HashMap;
#[derive(Copy, Clone, Debug)]
pub struct Server {}
lazy_static::lazy_static! {
static ref SERVER1: Server = Server {};
static ref SERVER2: Server = Server {};
pub static ref RAW: HashMap<&'static str, &'static Server> = [
("", &*SERVER1),
("", &*SERVER1),
("", &*SERVER2),
fn main() {
let server = RAW.get("");
println!("{:?}", server);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment