Rust note

Should I pass by reference or by value?

Pass by value unless...

  • type doesn't implement Copy trait (and you need to keep original after function call)
  • the type is large (structs etc)
  • you need to mutate the owner's value of the thing inside the called function