Note: Structs are allocated on the stack.
&
prefix&
prefix as follows:user
is &User
. It's a reference to User
.private
and immutable
by default. Their access modifiers can be changed with pub
and mut
.private mutable
.public immmutable
(readonly).public
, but mutable
only in the parent module.public
and mutable
both inside and outside parent module.User
information.Point
struct that holds x
and y
field and guard them with private and public.