this post was submitted on 12 Feb 2024
12 points (100.0% liked)

Learning Rust and Lemmy

391 readers
1 users here now

Welcome

A collaborative space for people to work together on learning Rust, learning about the Lemmy code base, discussing whatever confusions or difficulties we're having in these endeavours, and solving problems, including, hopefully, some contributions back to the Lemmy code base.

Rules TL;DR: Be nice, constructive, and focus on learning and working together on understanding Rust and Lemmy.


Running Projects


Policies and Purposes

  1. This is a place to learn and work together.
  2. Questions and curiosity is welcome and encouraged.
  3. This isn't a technical support community. Those with technical knowledge and experienced aren't obliged to help, though such is very welcome. This is closer to a library of study groups than stackoverflow. Though, forming a repository of useful information would be a good side effect.
  4. This isn't an issue tracker for Lemmy (or Rust) or a place for suggestions. Instead, it's where the nature of an issue, what possible solutions might exist and how they could be or were implemented can be discussed, or, where the means by which a particular suggestion could be implemented is discussed.

See also:

Rules

  1. Lemmy.ml rule 2 applies strongly: "Be respectful, even when disagreeing. Everyone should feel welcome" (see Dessalines's post). This is a constructive space.
  2. Don't demean, intimidate or do anything that isn't constructive and encouraging to anyone trying to learn or understand. People should feel free to ask questions, be curious, and fill their gaps knowledge and understanding.
  3. Posts and comments should be (more or less) within scope (on which see Policies and Purposes above).
  4. See the Lemmy Code of Conduct
  5. Where applicable, rules should be interpreted in light of the Policies and Purposes.

Relevant links and Related Communities


Thumbnail and banner generated by ChatGPT.

founded 9 months ago
MODERATORS
 

Just a quick rundown of things happening here recently.

Getting Started

We got started! And definitely have some interest here already!

See, if you missed them:


First Reading Club

We had our first "Reading Club Meeting"! This was for reading through "The Book".

See, if you missed it:

Note also that there's a section in the sidebar for "Running Projects", basically any "series" of regular posts/cadences for a specific shared project. There's plenty of scope for more here ... let me know your thoughts!

I think us new to the language pretty quickly started wrestling with the ideas around the borrow checker (who would have thought!), which is also the part of the "official reading" for the next reading club!

This reading club has a twitch stream running in parallel (see https://www.twitch.tv/deerfromsmoke), on Tuesday's, 6.30pm EST (New York Time). If you can't make it then, videos will be on youtube and discussions will happen here of course.

Personally, I think the value of "study groups" or "workshops" or "reading clubs" is often forgotten. I was quickly reminded of that when just being in the twitch stream or reading a comment on the post got me compiling rust code. This community and the reading club has already helped me learn rust better/quicker!


Fediverse Friends

Turns out there's a nice video series on Rust over on PeerTube (fediverse youtube), which nicely parallels our rust reading club.

Even more nicely, PeerTube and lemmy federate with each other, which means you can subscribe to the channel through your lemmy instance and comment directly on the videos from lemmy! The channel should be available at [email protected] (this may require nudging your instance to get it to fetch the details, and, if none of the rust videos show up, may need to be searched specifically to force your instance to back fill).

See the channel on PeerTube here: https://diode.zone/w/p/xesbWmNanEHNBfJCZFQRUm (and the first post here: https://lemmy.ml/post/11655570).

The author, Andy, is also a subscriber here and is likely interested in any comments you have.

They posted here on how fediverse interop does work: https://mastodon.social/users/andybalaam/statuses/111906773513868731 (it's from mastodon but to this lemmy community and about their peertube account)


Recommended Rust Reading

For more experienced or confident rust programmers, having reading clubs for code bases or bigger/harder projects is probably a good idea.

We haven't got anything like that up and running, but we probably could and should.

To that end:

  • the rust crate/package for managing ActivityPub federation, employed by lemmy, was suggested (see GitHub Repo and post here)
  • The new lemmy API client re-written in rust (for the upcoming leptos front-end): see post here

Let me know if you're interested in having a regular reading group for such things!


Rust Practice Projects

Something that's been spoken about is starting to work together on projects or puzzles to practice our rust as we learn.

Advent of code with rust is one idea that may become a regular "series" here.

I'm sure there are others that you're interested in.

Personally, I'm thinking of just diving in and trying to make a basic "ToDo" web app with rust using Actix-web (web framework) and diesel (sql ORM in rust), both of which are used by lemmy, and some http template renderer. I'd probably stall pretty quickly but it's also such a common thing that fumbling around on it might be quite productive.

Anyone else interested in something like that as a regular/weekly series of posts for facilitating loosely collective work?

you are viewing a single comment's thread
view the rest of the comments
[–] freamon 5 points 9 months ago* (last edited 9 months ago)

Re: Andy's videos, if you're on an instance that someone else hasn't already brought videos through, it'll deffo show 0 posts when you resolve the community, due to a difference in 'outbox' formats between lemmy and peertube.

The specific error from journalctl:

Feb 10 12:53:29 debian lemmy_server[996]: Lemmy v0.19.3-rc.1
Feb 10 12:53:30 debian lemmy_server[996]: Federation enabled, host is charming-molly-outgoing.ngrok-free.app
Feb 10 12:53:30 debian lemmy_server[996]: Starting HTTP server at 127.0.0.1:8536
Feb 10 12:56:33 debian lemmy_server[996]: 2024-02-10T12:56:33.942201Z  WARN lemmy_utils: error in spawn: Unknown: Failed to parse object https://diode.zone/video-channels/andybalaam_lectures/outbox with content {"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"RsaSignature2017":"https://w3id.org/security#RsaSignature2017"}],"id":"https://diode.zone/video-channels/andybalaam_lectures/outbox","type":"OrderedCollection","totalItems":112,"first":"https://diode.zone/video-channels/andybalaam_lectures/outbox","type":"OrderedCollection","totalItems":112,"first":"https://diode.zone/video-channels/andybalaam_lectures/outbox?page=1"}: missing field `orderedItems` at line 1 column 341
Feb 10 12:56:33 debian lemmy_server[996]:    0: lemmy_apub::objects::community::from_json
Feb 10 12:56:33 debian lemmy_server[996]:              at crates/apub/src/objects/community.rs:126
Feb 10 12:56:33 debian lemmy_server[996]:    1: lemmy_apub::fetcher::user_or_community::from_json
Feb 10 12:56:33 debian lemmy_server[996]:              at crates/apub/src/fetcher/user_or_community.rs:87
Feb 10 12:56:33 debian lemmy_server[996]:    2: lemmy_apub::http::person::person_inbox
Feb 10 12:56:33 debian lemmy_server[996]:              at crates/apub/src/http/person.rs:46
Feb 10 12:56:33 debian lemmy_server[996]:    3: lemmy_server::root_span_builder::HTTP request
Feb 10 12:56:33 debian lemmy_server[996]:            with http.method=POST http.scheme="https" http.host=charming-molly-outgoing.ngrok-free.app http.target=/u/admin/inbox otel.kind="server" request_id=8f29de66-b7c9-4221-a66d-5a7431cb05b3
Feb 10 12:56:33 debian lemmy_server[996]:              at src/root_span_builder.rs:16

I mostly mention this to highlight the value in running sudo journalctl -u lemmy -f whilst doing stuff with your own test instances of lemmy.


To help bring videos through, click these links:

The Community

Video 01
Video 02
Video 03
Video 04
Video 05
Video 06
Video 07
Video 08
Video 09
Video 10
Video 11

These links are for your instance's '/search' endpoint (which is how they do it over at mbin, incidentally). It's unlikely to get a result on the first try, but clicking 'search' 1 or 2 more times and it waiting a bit, should get you somewhere. (I tested these links on the basic website btw, dunno what'll happen if you try from apps or front-ends)

edit: thought I'd double check for these links - works on instances I tried running 0.19.3, can't get lemmy.world (on 0.18.5) to resolve it though.

edit 2: tried on test instance that's running 0.18.5 (like lemmy.world), and it errors searching for the PeerTube channel - the error message just says 'failed to resolve actor via webfinger'. The webfinger responses for his channel and for a lemmy community aren't that different, so I don't know why, but it confirms that you won't be able to subscribe to his channel if you're on lemmy.world whilst they're still on 0.18.5.