daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::sync::Arc;
  2.  
  3. #[derive(Debug)]
  4. struct Executor {
  5.     module: bool
  6. }
  7.  
  8. impl Executor {
  9.     pub fn load() -> Result<&'static Executor, ()> {
  10.             Ok( &Executor{ module: true } )
  11.     }
  12. }
  13.  
  14. #[derive(Debug)]
  15. struct ExecutorArc {
  16.     module: Arc<bool>
  17. }
  18.  
  19. impl ExecutorArc {
  20.     pub fn load() -> Result<&'static ExecutorArc, ()> {
  21.             Ok( &ExecutorArc { module: Arc::new( true ) } )
  22.     }
  23. }
  24.  
  25. fn main() {
  26.     let executor = Executor::load().unwrap();
  27.     println!("executor = {:?}", executor);
  28.  
  29.     let executor_arc = ExecutorArc::load().unwrap();
  30.     println!("executor_arc = {:?}", executor_arc);
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top