Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::sync::Arc;
- #[derive(Debug)]
- struct Executor {
- module: bool
- }
- impl Executor {
- pub fn load() -> Result<&'static Executor, ()> {
- Ok( &Executor{ module: true } )
- }
- }
- #[derive(Debug)]
- struct ExecutorArc {
- module: Arc<bool>
- }
- impl ExecutorArc {
- pub fn load() -> Result<&'static ExecutorArc, ()> {
- Ok( &ExecutorArc { module: Arc::new( true ) } )
- }
- }
- fn main() {
- let executor = Executor::load().unwrap();
- println!("executor = {:?}", executor);
- let executor_arc = ExecutorArc::load().unwrap();
- println!("executor_arc = {:?}", executor_arc);
- }
Add Comment
Please, Sign In to add comment