3 ms·
You are correct. The type signature for push takes a mutable reference to self. The code for a vector of i32s could look something like: impl Vec {
by thethirdone 7y ago
You are correct. The type signature for push takes a mutable reference to self.
The code for a vector of i32s could look something like:
impl Vec {
pub fn push(&mut self, x:i32){
// internal details
}
}
- supermatt 7y agoMany thanks. I think most of the confusion is to do with the comments, some of which the author has resolved so now my comment doesn't make much sense. But in the context of the original statement, thanks for your confirmation :)