Is there a way to distingush between different `Rc`s of the same value?
问题 Here's an example: use std::rc::Rc; #[derive(PartialEq, Eq)] struct MyId; pub fn main() { let rc_a_0 = Rc::new(MyId); let rc_a_1 = rc_a_0.clone(); let rc_b_0 = Rc::new(MyId); let rc_b_1 = rc_b_0.clone(); println!("rc_a_0 == rc_a_1: {:?}", rc_a_0 == rc_a_1); println!("rc_a_0 == rc_b_0: {:?}", rc_a_0 == rc_b_0); } Both println! s above print true . Is there a way distinguish between the rc_a_* and rc_b_* pointers? 回答1: You can cast &*rc to *const T to get a pointer to the underlying data and