bytecodealliance / bytecodealliance/rustix
Use a more descriptive comment convention
- Lingua principale
- Rust
- Stelle
- 2.1k
- Fork
- 294
- Merge medio
- 6g 22h
- PR unite (30g)
- 4
Descrizione
Currently many functions in rustix are documented with a comment that looks like this:
```rust
/// `openat(dirfd, path, oflags, mode)`—Opens a file.
///
/// POSIX guarantees that `openat` will use the lowest unused file descriptor,
/// however it is not safe in general to rely on this, as file descriptors may
/// be unexpectedly allocated on other threads or in libraries.
///
/// The `Mode` argument is only significant when creating a file.
///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/openat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/open.2.html
```
It starts with a C-ish pseudocode corresponding to what the function does, followed by a short description. My idea was to highlight the correspondence to C, since all the OS documentation is written in terms of C, and rustix isn't currently in a position to have its own complete documentation for everything.
But perhaps it would be better to move the C-ish pseudo-code later, like this, so that the first line is just a description of the thing:
```rust
/// Opens a file.
///
/// POSIX guarantees that `openat` will use the lowest unused file descriptor,
/// however it is not safe in general to rely on this, as file descriptors may
/// be unexpectedly allocated on other threads or in libraries.
///
/// The `Mode` argument is only significant when creating a file.
///
/// # C pseudocode
///
/// ```c
/// openat(dirfd, path, oflags, mode)
/// ```
///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/openat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/open.2.html
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia esaminando la documentazione esistente delle funzioni di rustix, in particolare i commenti che usano la convenzione openat mostrata, e confrontala con il formato proposto nell’issue. Il lavoro non è pronto per iniziare finché il progetto non avrà concordato una convenzione; sarà considerato completato quando lo stile di documentazione concordato sarà stato applicato in modo coerente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100