Skip to content

Instantly share code, notes, and snippets.

@kestein
Created August 16, 2016 15:13
Show Gist options
  • Save kestein/0c0df0352b92df527424333889c8d95c to your computer and use it in GitHub Desktop.
Save kestein/0c0df0352b92df527424333889c8d95c to your computer and use it in GitHub Desktop.
Lel, make things static at runtime
let x = vec![String::from("asdf1234"), String::from("fdsa4312")];
let mut y: Vec<&'static str> = Vec::new();
for e in x {
unsafe {
let r = mem::transmute(&e as &str);
mem::forget(e);
y.push(r);
}
}
@kestein
Copy link
Author

kestein commented Aug 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment