mirror of
https://github.com/gnu4cn/rust-lang-zh_CN.git
synced 2025-04-02 23:50:24 +08:00
Update Ch15
This commit is contained in:
parent
1ec35c1682
commit
ee160e4af6
@ -11,10 +11,19 @@ use std::rc::Rc;
|
||||
fn main() {
|
||||
let value = Rc::new(RefCell::new(5));
|
||||
|
||||
let a = Rc::new(Cons(Rc::clone(&value), Rc::new(Nil)));
|
||||
let a = Rc::new(Cons(
|
||||
Rc::clone(&value),
|
||||
Rc::new(Nil)
|
||||
));
|
||||
|
||||
let b = Cons(Rc::new(RefCell::new(3)), Rc::clone(&a));
|
||||
let c = Cons(Rc::new(RefCell::new(4)), Rc::clone(&a));
|
||||
let b = Cons(
|
||||
Rc::new(RefCell::new(3)),
|
||||
Rc::clone(&a)
|
||||
);
|
||||
let c = Cons(
|
||||
Rc::new(RefCell::new(4)),
|
||||
Rc::clone(&a)
|
||||
);
|
||||
|
||||
*value.borrow_mut() += 10;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user