Closed IGreyGooI closed 2 years ago
Sorry for the very late reply but I was on vacation.
That's because you're modifying the channel (or Sender
in this case). Since we're using mutex internally, at the moment it's not needed but if we were to change the implementation so that we require exterior mutability (i-e &mut self
), we'll have to break the API so it's future proof at least. IMO it also makes it explicitly clear that channel is being modified by the call.
I hope that answers you question.
Or is there a reason for both functions to only take exclusive references?