1 use std::thread; 2 3 use fragile::Sticky; 4 main()5fn main() { 6 fragile::stack_token!(tok); 7 8 // creating and using a fragile object in the same thread works 9 let val = Sticky::new(true); 10 println!("debug print in same thread: {:?}", &val); 11 println!("try_get in same thread: {:?}", val.try_get(tok)); 12 13 // once send to another thread it stops working 14 thread::spawn(move || { 15 fragile::stack_token!(tok); 16 println!("debug print in other thread: {:?}", &val); 17 println!("try_get in other thread: {:?}", val.try_get(tok)); 18 }) 19 .join() 20 .unwrap(); 21 } 22