Why an implement of immutable trait can be mutable?
Advertisements Here is my code, it can compile trait AppendBar { fn append_bar(self) -> Self; } impl AppendBar for Vec<String> { fn append_bar(mut self) -> Self { self.push("Bar".to_string()); self } although it takes the ownership, but why it can mutate self in its implementation? >Solution : Because mutability of arguments is not part of the… Read More Why an implement of immutable trait can be mutable?