bytecodealliance / bytecodealliance/rustix
Use a more descriptive comment convention
- Vorherrschende Sprache
- Rust
- Sterne
- 2.1k
- Forks
- 294
- Ø Merge
- 6 T. 22 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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
```
Beitragsleitfaden
Rechercherichtung
Beginne mit der Durchsicht der vorhandenen Dokumentation zu rustix-Funktionen, insbesondere der Kommentare, die die gezeigte openat-Konvention verwenden, und vergleiche sie mit dem im Issue vorgeschlagenen Format. Die Arbeit ist noch nicht bereit zu beginnen, bevor sich das Projekt auf eine Konvention geeinigt hat; als erledigt gilt sie, wenn der vereinbarte Dokumentationsstil durchgängig angewendet wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100