data = Data { value: String::from("Hello Berlin!") }; taking_ownership(data); // data cannot be used here } fn taking_ownership(mut data: Data) { share_immutably(&data); share_mutably(&mut data); }
} fn main() { let ref_counted_integer = Rc::new(43); for i in 1..3 { let mut handle = ref_counted_integer.clone(); std::thread::spawn(move || { increment(&mut handle); // the trait `std::marker::Send` is not implemented for `std::rc::Rc<i32>` }); } }