Does ownership not apply to integers?

94 points prawnydagrate

I'm learning about ownership and borrowing in Rust, and I don't understand why this code works:

fn add(x: i8, y: i8) -> i8 {
  x + y
}

fn main() {
  let (x, y) = (2, 4);
  println!("{}", add(x, y));
  println!("{}", add(x, y));
}

I thought ownership of x and y would be dropped on the first call of add, but apparently not. The program outputs:

6
6

Why is this so?

Edit: Alright, I get that integers are copied. What other typed are like this, and how could I make my own struct copied?

Edit: Nvm, I just read the documentation and I understand. Thanks for all your help!