Open alice-i-cecile opened 2 years ago
There are also some tips in the rustdoc book about writing good API documentation.
Some interesting tips from recent experience and discussion with @alice-i-cecile:
More thoughts on stuff to add:
Another useful pattern that I recently adopted: when documenting a data type, put under a “Usage” section:
In some cases I found useful to create should_panic
doctests. A system can be made easily run to check if it panics with the following pattern:
/// # let mut my_system = bevy_ecs::system::IntoSystem::into_system(my_system_function);
/// # let mut world = World::new();
/// # my_system.initialize(&mut world);
/// # my_system.run((), &mut world);
If we end up using the advice of breaking lines at sentence/clause-level, we also should remove the wrap_comments
option from rustfmt.toml
. Otherwise, that would end up breaking comments where we don't want to.
The option is currently commented, however it is presented as being potentially uncommented on need (probably for some occasional workflows).
Initial notes from Discord:
DocLinks
].These should be stored in a sibling to https://github.com/bevyengine/bevy/blob/main/.github/contributing/engine_style_guide.md, which should be linked in https://github.com/bevyengine/bevy/blob/main/CONTRIBUTING.md