this post was submitted on 16 Jul 2024
22 points (100.0% liked)

Learning Rust and Lemmy

392 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 10 months ago
MODERATORS
 

I'll be clear, quite embarrassingly I bit my tongue hard last night and haven't been talking right all day. Hurts to talk, hurts to eat, and worst of all hot tea is undrinkable. How will I live. Now I know exactly what it feels like to be soldier wounded in combat.

Will resume next week in full force. In the meantime however please feel free to read ahead. Or, alternatively, try out a few leetcode\advent of code questions. This what I'll be doing tonight.

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 5 months ago* (last edited 2 months ago) (1 children)

No tea!? I hope that at least you live in northern hemisphere. Not having tea is easier in warm summer climat.
Get well soon.

[–] [email protected] 1 points 2 months ago (1 children)

I like tea all year round, winter or summer. Though I prefer iced tea in the summer.

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

I love magrebian mint tea in summer. You drink it hot yet it is so refreshing

[–] [email protected] 3 points 5 months ago

Get well soon! I'll use that time to catch up

[–] [email protected] 3 points 5 months ago

Ouch! I hope you get well soon.

[–] [email protected] 2 points 5 months ago

Oh god! I feel this ... I've bitten into my inner cheek real bad in the past! Hope you heal well!


I don't know where you got up to last stream but I'm presuming you've gotten a fair way through the smart pointers chapter (perhaps finished it).

Any one have thoughts on them or general experience with the concept? I don't and am curious what everyday use cases they offer (as I'm unclear)

As far as Box is concerned, I get the use case for large data structures, where moving a pointer around is cheaper but because it also owns its data you don't have to worry about lifetimes.

I've seen (and posted somewhere here before) about how a struct should never have a reference as a field but should have a box instead ... not sure I appreciate what that scenario looks like.

Rc seems genuinely useful as a way of just opting out of lifetimes and ownership when the data doesn't need to be mutable.

And then RefCell, especially in combination with Rc, seems ideal for constructing interesting data structures that seems much more natural for package development rather than in application, but feels like a nice technique for when the time comes. Anyone aware of some good patterns of general use with RefCell and Rc?

I'm currently reading through the concurrency chapter and it seems that the smart pointers of most practical use might be the concurrent equivalents: Arc (concurrent equivalent of Rc) and Mutex (concurrent equivalent of RefCell).


Beyond all of that ... this stream is pretty close to finishing the book and moving on to other more practical things ... any one have any thoughts on what to do that could work well at a collective level?