I'm having these conversations with the borrow checker, as one does, and it goes E0596! and then patiently explains that it simply can't borrow this as mutable and points to the exact spot in my source file where it ran in to the problem:
self.inner.by_ref().map(…) ^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable
But that's not quite enough to know where we're not seeing eye to eye. The linked explanation for E0596 says
This error occurs because you tried to mutably borrow a non-mutable variable.
but I didn't know I tried to mutably borrow a non-mutable variable. There is not a single
borrow in that source listing it's showing.
So I guess it must be from the
.by_ref()? What's the signature? Where is it declared? Is it something that's implemented on the type of
self.inner, or is it from some other trait it's picked up? Which one? Does it have a link to the rustdoc for it? That would be helpful.
Cargo build ends with
To learn more, run the command again with --verbose.
but that does not seem to have added anything that looks like it answers any of those questions.
Is there a different build flag I should be using to get more visibility in to what's going on?
Or does this mean it's time for me to get set up with an IDE with proper rust type inspection and code navigation? I have been thinking about doing that, but since I'm only just barely growing past my
main function, I haven't yet looked too closely at what's available there.
Thanks rustaceans! I think we're going to get along well once I figure out who keeps moving my cheese.