not sure I'm completely getting the necessity of Rc; per the book, this would not work: enum List { Cons(i32, &List), Nil, } fn main() { let x = Cons(3, &Nil); } because, the Nil would get dropped before you can take a ref to it
Yeah, a general rule of thumb is that structures want to own their contents, functions want to borrow them.
-
-
so if a structure can contain multiple routes to the same thing (a graph), then I use Rc, got it :)
-
Or `Arc` if you want to be able to pass it across threads.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.