Structs
The following code shows basic use of a struct.
Point
is thus defined as a data structure containing two float fields x
and y
.
You can define instances of Point
like so:
Struct fields are always mutable. You can access fields of a struct like this:
We can also implement methods on our structs. This will feel very familiar for people with Rust experience.
Last updated