Closures

Aperta
#1,746 8 commenti 2 reazioni 0 assegnatari Vedi su GitHub

@junderw ci sta già lavorando.

Dal 2/9/2024.

  • #2099 di @junderw — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
32/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
documentation

Direzione di ricerca

Non sono indicati file, test o punti di ingresso. Inizia esaminando la struttura esistente delle lezioni e il modo in cui sono delimitati gli esercizi di Rustlings, quindi valuta se gli argomenti proposti su closure, trait Fn* e async-block siano adatti. Il lavoro è considerato completato quando l'ambito è stato concordato e sono state aggiunte lezioni revisionate che coprono le quattro aree elencate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A-exercises C-new-exercise P-medium

One topic I see new people hit pretty early on is the capturing semantics and the Fn* traits.

I was thinking of adding a few lessons to show:

  1. Capturing semantics without move
  2. Capturing semantics with move (including ie. binding a reference to a variable before using it in the closure and a reference is moved)
  3. How the Fn* traits are auto-implemented.
  4. Briefly mention that async block capturing is similar to closure capturing, but that there is no Fn* traits for async-block-futures.

I wanted to read the room a bit before actually putting time into this. Do we think this might be a bit too advanced for rustlings? Would it depend on the actual content? Would anyone be willing to help review my lessons to try and get it over the finish line?

It's an issue I get asked about constantly, especially when dealing with GUI frameworks like egui that make use of lots of nested closures... it might help people intuit these issues more clearly.

Let me know what you think!

Lingua principale
Rust
Stelle
64.8k
Fork
11.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rustlings

Tutte le issue di rust-lang/rustlings

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.