I have a struct called Layer and a save_as_ppm function inside a impl block, the signature of the function is this:
fn save_as_ppm(&self, filename: &str){}
But other functions inside the impl block have &mut self parameter so when I create an instance I have to make it mutable (I don't know if it's called an instance in Rust).
let mut inputs = Layer::new(SAMPLE_SIZE as usize, SAMPLE_SIZE as usize);
But when I call this save_as_ppm function:
inputs.save_as_ppm(&filepath)
It compiles. My question is why does it compile? save_as_ppm takes a reference to self but I've just passed a mutable self. Shouldn't the compiler give an error? At least a warning?
 
    