"I guess I can share the server's model files with you"

rust fan boy image credit

The server developer was nice enough to share these models with you, to ease development. There are two basic structures here, a ToDo "struct" and a Message "enum".

Before we go over the details of these models let's go over what "struct" and "enum" are in Rust.

Structs are Rust's way of defining objects. When defining a struct you first define the fields/properties, if you need to add any functions or methods you would do that in a separate code block called an impl block.

Enums in rust work a bit differently than in most languages, the biggest difference being the ability to associate dynamic values with cases. This is useful when you have a case that is closely tied to some data, you'll see what I mean when we get to the Message enum. The other big difference is that enums can have their own impl blocks, meaning they can have functions/methods too!

With that out of the way, lets take a look at what the server developer provided.