Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. static mut my_list: Option<Vec<String>> = None;
  2.  
  3. unsafe fn init() {
  4. my_list = Some(vec![]);
  5. my_list.as_mut().unwrap().push("item0".to_string());
  6. my_list.as_mut().unwrap().push("item0".to_string());
  7. }
  8.  
  9. fn main() {
  10. println!("Hello, world!");
  11. unsafe {
  12.  
  13. init();
  14. read();
  15. };
  16.  
  17. }
  18.  
  19. unsafe fn read() {
  20. println!("{:?}", my_list);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement