|
|
@ -64,7 +64,7 @@ fn main() {
|
|
|
|
let a = Rc::new(String::from("test ref counting"));
|
|
|
|
let a = Rc::new(String::from("test ref counting"));
|
|
|
|
println!("count after creating a = {}", Rc::strong_count(&a));
|
|
|
|
println!("count after creating a = {}", Rc::strong_count(&a));
|
|
|
|
let b = Rc::clone(&a);
|
|
|
|
let b = Rc::clone(&a);
|
|
|
|
println!("count after creating b = {}", Rc::strong_count(&a));
|
|
|
|
println!("count after creating b = {}", Rc::strong_count(&b));
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let c = Rc::clone(&a);
|
|
|
|
let c = Rc::clone(&a);
|
|
|
|
println!("count after creating c = {}", Rc::strong_count(&c));
|
|
|
|
println!("count after creating c = {}", Rc::strong_count(&c));
|
|
|
|