Despite thoroughly reading the documentation, I\'m rather confused about the meaning of the &
and *
symbol in Rust, and more generally about wh
From the docs for std::ops::Add
:
impl<'a, 'b> Add<&'a i32> for &'b i32
impl<'a> Add<&'a i32> for i32
impl<'a> Add for &'a i32
impl Add for i32
It seems the binary + operator for numbers is implemented for combinations of shared (but not mutable) references of the operands and owned versions of the operands. It has nothing to do with automatic dereferencing.