well, if it were on stack, then you wouldn't be able to do this: let foo = Rc::new(42); let bar = Rc::clone(&foo); drop(foo); assert_eq!(*bar, 42);
same thing? the only difference is that Arc uses atomic operations for counting references, while Rc doesn't
ok got it, I actually didn't knew this
Обсуждают сегодня