Skip to content

Updates to doc structures and using rustdoc format #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Conversation

yashaswi2000
Copy link
Contributor

@yashaswi2000 yashaswi2000 commented Jun 17, 2024

Description

Reformatting documentation to follow rustdoc format. enabling us to move towards Rust crate style documentation, supporting auto doc generation.
will be adding general templates for documenting structs, functions, traits here - style guide

Following rustdoc book for overall guidance and rust docs conventions from microsoft opensource resources.
rustdoc book
templates

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A - lind_project/tests/test_cases/test_a.c
  • Test B - lind_project/tests/test_cases/test_b.c

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

Copy link
Member

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few minor lessons learned from my work with rustdoc on fdtables. Let me know if any of my feedback isn't clear...

Copy link
Member

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of comments here about what does and doesn't belong in Rustdoc. I'm happy to discuss further.

//!
//! Cages have methods for filesystem-related calls. They return a code or an error from the `errno` enum.
//!
//! - [open_syscall](crate::safeposix::cage::Cage::open_syscall)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, that Rustdoc will automatically create a list like this for you for each of the functions. I'm not sure you need to do this manually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the sys calls are implemented as part of Cage struct. and we implemented them in different modules for better maintainability. but rustdoc associates these functions to Cage struct and these modules turn up empty. so added these lists to redirect to the Cage docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, please make sure you indicate this in a comment in the code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(By the way, you can look at fdtables, which has a similar issue but gets around it. This may change the visibility / import structure of the code though. I honestly, don't recall exactly how I did this.)

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor change requests but mostly this looks good to go.

Copy link
Contributor

@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@rennergade
Copy link
Contributor

@JustinCappos Id love to get your approval on this one too before I merge it.

Copy link
Member

@JustinCappos JustinCappos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please do explain why the functions are listed the way they are for posterity. Otherwise, I think it's okay to merge.

@rennergade rennergade merged commit 7aee998 into develop Jun 25, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants