You are browsing as a guest. Sign up (or log in) to start making projects!

snakinal

  • 1 Devlogs
  • 1 Total hours

A snake game in the terminal [building this project to help me learn Rust for the first time!]

Open comments for this post

38m 30s logged

Devlog #1 (snakinal - a snake game in the terminal)

This is my first time in a long time doing something related to the terminal and also my first time with Rust 🦀 (I’ve fiddled with C++, so that background helps me connect to things in rust)! I’m going with a PBL (project based learning) route to quickly learn Rust (although I know Rust has a big learning curve). Also, shout out to Let’s Get Rusty’s rust learning playlist on YT.

Anyways, below I’ve managed to write something simple in the terminal through a bit of AI help. In this devlog I’ve learnt quite a bit of rust syntax:

  1. like how creating “classes” in rust has a 3 step procedure (struct, impl, and trait) instead of just class in other low level languages
  2. !() are macros that executes before compile time
  3. ?; is used on expressions that can return a success or fail, and to return the error immediately if it fails, also only works when the return type is Result<>
  4. learnt a bit about how crossterm library functions work
  5. also took me a year to understand why lsp/linting wouldn’t work for another file that I had. Apparently Rust doesn’t see files unless you do mod <filename> in main.rs
  6. One more thing that still slightly confuses me is the difference between :: & . and when to use one or the other (so if someone doesn’t mind commenting, I’d really appreciate!)

I hope this pointers have helped other beginner rusties, and if I’ve said something incorrect, rustaceans pls forgive me

0
0
42

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…