Guest User

Untitled

a guest
Jan 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment