use std::rc::Rc; struct Person { name:Rc } impl Person { fn new(name:Rc)->Person { Person {name: name} } fn selamla (&self) { println!("merhaba ben {}",self.name) } } fn rc_variable(){ let isim = Rc::new("Enes".to_string()); println!("isim= {} ve isimin strong pointer :{}",isim,Rc::strong_count((&isim))); let person=Person::new(isim.clone()); println!("isim= {} ve isimin strong pointer :{}",isim,Rc::strong_count((&isim))); person.selamla(); println!("isim= {} ve isimin strong pointer :{}",isim,Rc::strong_count((&isim))); println!("isim={}",isim); println!("isim= {} ve isimin strong pointer :{}",isim,Rc::strong_count((&isim))); } fn main() { rc_variable(); }