I'm reading the Rust book. It explains that when you create a function, you need to decide if your function will take ownership of its arguments, or take them as a mutable or immutable references.
What I'm not entirely clear about is if there's a syntactic difference between using an owned value within that function, or using a reference.
If you have a reference to a struct with methods, is the syntax for using those methods exactly the same as it would be if you were dealing with an owned variable? Are there any other difference between how one would use an owned variable, and how one would use a reference to that variable?
When do you need to dereference a reference variable? I've only seen dereferencing when you're trying to increment the value stored by the variable pointed to by a mutable reference to an int, or something like that. It seems like you only need to dereference it if you intend to replace the value of the variable entirely with something new. For example, if you want to run a method on a reference to a struct, you don't need to dereference, but if you want to replace the value with a completely difference instance of that struct, you need to dereference. Is that right?