Skip to content
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

Module-style doc strings for examples #3951

Closed
alice-i-cecile opened this issue Feb 14, 2022 · 5 comments
Closed

Module-style doc strings for examples #3951

alice-i-cecile opened this issue Feb 14, 2022 · 5 comments
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@alice-i-cecile
Copy link
Member

Every example should have a consistent, basic description of what it does.

IMO, the cleanest way to do this is to use the following style at the beginning of each example .rs file:

//! This example demonstrates how to do something really cool with Bevy
//! Check out all of the [`Structs`] and [`Traits`] it uses

use bevy::prelude::*;
use bevy::ecs::SomethingSpecial;

fn main(){
   App::new()
   .add_system(do_cool_things)
   .run()
}

If you would like to tackle this issue, please go through each example and add / move the description to this format.

@Nilirad
Copy link
Contributor

Nilirad commented May 3, 2022

I did a search pass on open PRs adding new examples and posted a comment pointing to this issue (with some suggestions sometimes).

bors bot pushed a commit that referenced this issue May 16, 2022
# Objective

Provide a starting point for #3951, or a partial solution. 
Providing a few comment blocks to discuss, and hopefully find better one in the process. 

## Solution

Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. 

## Changelog

- Moved some existing comments from main() functions in the 2d examples to the file header level
- Wrote some more comment blocks for most other 2d examples

TODO: 
- [x] 2d/sprite_sheet, wasnt able to come up with something good yet 
- [x] all other example groups...


Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. 
I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
@alice-i-cecile
Copy link
Member Author

Closed by #4438.

robtfm pushed a commit to robtfm/bevy that referenced this issue May 17, 2022
# Objective

Provide a starting point for bevyengine#3951, or a partial solution. 
Providing a few comment blocks to discuss, and hopefully find better one in the process. 

## Solution

Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. 

## Changelog

- Moved some existing comments from main() functions in the 2d examples to the file header level
- Wrote some more comment blocks for most other 2d examples

TODO: 
- [x] 2d/sprite_sheet, wasnt able to come up with something good yet 
- [x] all other example groups...


Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. 
I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
exjam pushed a commit to exjam/bevy that referenced this issue May 22, 2022
# Objective

Provide a starting point for bevyengine#3951, or a partial solution. 
Providing a few comment blocks to discuss, and hopefully find better one in the process. 

## Solution

Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. 

## Changelog

- Moved some existing comments from main() functions in the 2d examples to the file header level
- Wrote some more comment blocks for most other 2d examples

TODO: 
- [x] 2d/sprite_sheet, wasnt able to come up with something good yet 
- [x] all other example groups...


Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. 
I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
@tigregalis
Copy link
Contributor

Out of interest, is there any first-class support for Module-style doc strings for examples in Rust(Rustdoc)? (If there isn't, there should be)

@alice-i-cecile
Copy link
Member Author

Hmm, I'm not immediately sure! Try building the repo docs locally with cargo doc and see what shows up.

@Nilirad
Copy link
Contributor

Nilirad commented Jul 12, 2022

@tigregalis AFAIK, cargo doc can't render docs for examples. Using barebones rustdoc you should be able to do that, but I never did that.

ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

Provide a starting point for bevyengine#3951, or a partial solution. 
Providing a few comment blocks to discuss, and hopefully find better one in the process. 

## Solution

Since I am pretty new to pretty much anything in this context, I figured I'd just start with a draft for some file level doc blocks. For some of them I found more relevant details (or at least things I considered interessting), for some others there is less. 

## Changelog

- Moved some existing comments from main() functions in the 2d examples to the file header level
- Wrote some more comment blocks for most other 2d examples

TODO: 
- [x] 2d/sprite_sheet, wasnt able to come up with something good yet 
- [x] all other example groups...


Also: Please let me know if the commit style is okay, or to verbose. I could certainly squash these things, or add more details if needed. 
I also hope its okay to raise this PR this early, with just a few files changed. Took me long enough and I dont wanted to let it go to waste because I lost motivation to do the whole thing. Additionally I am somewhat uncertain over the style and contents of the commets. So let me know what you thing please.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

No branches or pull requests

3 participants