Learning Rust, Day 1

I decided to start learning Rust and wanted to try something I’ve never done: write about it while learning.

The Idea

Notes while reading

Working with code

I didn’t get very far today. This is an abbreviated excerpt:

struct Card {
    rank: Rank,
    suit: Suit
}

enum Rank {
    Two,
    Three,
    # etc
    King,
    Ace
}

enum Suit {
    Hearts,
    Spades,
    Diamonds,
    Clubs
}

impl Card {
    fn new(rank: Rank, suit: Suit) -> Card {
        Card {
            rank,
            suit
        }
    }
}

Some notes on this:

That’s all for now!