File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 51
51
//! fn main() {
52
52
//! // Create a reference counted Owner.
53
53
//! let gadget_owner : Rc<Owner> = Rc::new(
54
- //! Owner { name: String::from("Gadget Man") }
54
+ //! Owner { name: String::from("Gadget Man") }
55
55
//! );
56
56
//!
57
57
//! // Create Gadgets belonging to gadget_owner. To increment the reference
102
102
//!
103
103
//! struct Owner {
104
104
//! name: String,
105
- //! gadgets: RefCell<Vec<Weak<Gadget>>>
105
+ //! gadgets: RefCell<Vec<Weak<Gadget>>>,
106
106
//! // ...other fields
107
107
//! }
108
108
//!
109
109
//! struct Gadget {
110
110
//! id: i32,
111
- //! owner: Rc<Owner>
111
+ //! owner: Rc<Owner>,
112
112
//! // ...other fields
113
113
//! }
114
114
//!
117
117
//! // Owner's vector of Gadgets inside a RefCell so that we can mutate it
118
118
//! // through a shared reference.
119
119
//! let gadget_owner : Rc<Owner> = Rc::new(
120
- //! Owner {
121
- //! name: "Gadget Man".to_string(),
122
- //! gadgets: RefCell::new(Vec::new())
123
- //! }
120
+ //! Owner {
121
+ //! name: "Gadget Man".to_string(),
122
+ //! gadgets: RefCell::new(Vec::new()),
123
+ //! }
124
124
//! );
125
125
//!
126
126
//! // Create Gadgets belonging to gadget_owner as before.
You can’t perform that action at this time.
0 commit comments