I have to share access to Foo for a while, but eventually, it needs to be taken from the Rc. I thought that was what .into_inner did. But apparently not. .into _inner wants to copy. I want to consume the Rc and return ownership of the RefCell inside. Is there some way to do that?
Method call resolution on types that implement Deref perform deref coercion[1] in order to find the correct receiver type. This means you end up calling RefCell::into_inner in your example, which'd move the data out of a shared reference to the RefCell (that you get from <Rc as Deref>::deref implicitly added as part of the aforementioned method call resolution), which is not allowed.
Edit: I don't think deref coercion is the correct term to use here, it's more that &<Rc as Deref>::Target is added to the list of possible method call receivers. âŠī¸