Good resources for learning Rust?

I’m looking to get a lemmy bot figured out for posting sports scores in real-time (or near it) like Reddit had for NHL games. The lemmy api reference states that rust has the api as a loadable library, but I’ve only ever done C/C++ and python. Anything Coursera style to get a basic overview of how to get started in Rust?

I did also see lemmy-bot but it looks like it doesn’t handle post editing at the moment, and not sure i really want to learn how to use npm to be honest.

Double_A,
@Double_A@discuss.tchncs.de avatar

If you have a JetBrains IDE you can install this plugin, which interactively works you through the rustlings course: plugins.jetbrains.com/plugin/…/about

randombit,

If you would like to use this project to learn Rust, go for it! However, there are utilities that will convert Lemmy’s TypeScript to Python. There are also a few Lemmy Python packages on GitHub.

natecox,

More votes here for “the book”, it got me through publishing my first community app quite nicely.

kalanggam,

I recommend checking out fasterthanlime's "A half-hour to learn Rust" if you want a brief breakdown of Rust syntax and key features, in addition to The Book and Rust by Example.

TehPers,

There are a few resources out there, but a good starting place is the book. There's also Rust by example which has example snippets for doing various tasks.

Also, keep in mind that Rust is a very different language from C, C++, and Python. It's going to be hard to learn it if you try to treat the higher level concepts (structs, enums, traits, etc) like how other languages you know work. Take your time, it takes most people a lot longer to learn Rust than to learn most other traditional languages.

socphoenix,

Thank you! And thank you for the tip I had a feeling it looked just similar enough to be deceiving.

TehPers,

I had a feeling it looked just similar enough to be deceiving.

I think there's a few places where this is true in Rust especially. For example, coming from a C-style language (and Python) the enum keyword throws a lot of people off. In Rust, while you can use an enum to represent a set of "constant" values, it's more common to use it to represent a tagged union, making it more like https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/discriminated-unions:

// a union:
enum Response {
    Html(String),
    Text(String),
    Json(serde_json::Value),
}

// or a more C-style enum:
#[repr(u16)]
enum StatusCode {
    BadRequest = 400,
    NotFound = 404,
    // ...
}

You might find that some concepts look and feel similar to what you might see in traditional OOP languages, but often end up working more like something out of a functional language.

spirit_kun,

I recommend The Rust book too. Great for beginners. If you are more advanced developer the Tokio runtime documentation has a tutorial on how to create a mini redis clone https://tokio.rs/tokio/tutorial

  • All
  • Subscribed
  • Moderated
  • Favorites
  • programming@beehaw.org
  • DreamBathrooms
  • InstantRegret
  • thenastyranch
  • magazineikmin
  • everett
  • rosin
  • Youngstown
  • slotface
  • cubers
  • cisconetworking
  • kavyap
  • GTA5RPClips
  • osvaldo12
  • tacticalgear
  • JUstTest
  • khanakhh
  • mdbf
  • Durango
  • ngwrru68w68
  • tester
  • normalnudes
  • ethstaker
  • provamag3
  • modclub
  • Leos
  • anitta
  • megavids
  • lostlight
  • All magazines