Skip to content

Commit 08b9fd4

Browse files
committed
doc(guidelines): adapt to the new API design
1 parent b4b088b commit 08b9fd4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

doc/guidelines.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,15 @@ Exceptions:
6161

6262
### Optional features should be documented properly (CC-DOC-OPT-FEATURES)
6363

64-
All optional features of `r3` must be listed and explained in the crate-level documentation.
64+
All optional features of `r3` and `r3_kernel` must be listed and explained in the crate-level documentation.
6565

6666
In addition, every public item gated by such features must have [`#[doc(cfg(feature = ...))]` attribute](https://github.com/rust-lang/rust/issues/43781), which displays the required feature on the generated documentation.
6767

6868
```rust
69-
/// Get the current [system time].
70-
///
71-
/// [system time]: crate#kernel-timing
69+
/// Get the current system time.
7270
#[cfg(feature = "system_time")]
7371
#[doc(cfg(feature = "system_time"))]
74-
fn time() -> Result<Time, TimeError>;
72+
pub fn time() -> Result<Time, TimeError>;
7573
```
7674

7775
## Testing
@@ -107,18 +105,18 @@ The runtime overhead caused by unused features should be minimized or eliminated
107105

108106
Example: If no startup hooks are defined, the compiler will simply remove the startup hook initialization loop because it can figure out that `STARTUP_HOOKS` has no elements.
109107

110-
- If the usage of such features can be detected statically in a configuration macro (e.g., `r3::build!`), the macro should control the type choices based on that.
108+
- If the usage of such features can be detected statically in a configuration macro (e.g., `r3_kernel::build!`), the macro should control the type choices based on that.
111109

112110
Examples:
113111

114112
- `r3_portkit::tickful::TickfulState` (used by timer drivers) chooses the optimal algorithm based on parameters.
115113

116114
- Kernel objects are defined statically and their control blocks are stored in static arrays.
117115

118-
- If the above options are infeasible, expose either a `CfgBuilder` method or a Cargo feature to let downstream crates and application developers specify whether a feature should be compiled in.
116+
- If the above options are infeasible, expose either a method in `Cfg` or a Cargo feature to let downstream crates and application developers specify whether a feature should be compiled in.
119117

120118
Examples:
121119

122120
- The system clock is controlled by `system_time` feature. The system time is tracked by an internal variable that is updated on timer interrupts, and there's no hope of the compiler optimizing this out. It's impossible for `build!` to detect the usage of `System::time()`. The system clock is not tied to any particular kernel objects, so the software components dependent on the system clock might not have a configuration function. On the other hand, Cargo features are designed exactly for this use case.
123121

124-
- Application code can change task priorities at runtime. The maximum (lowest) priority affects the size of internal kernel structures, but it's impossible for `build!` to figure that out. Therefore, `CfgBuilder` exposes `num_task_priority_levels` method.
122+
- Application code can change task priorities at runtime. The maximum (lowest) priority affects the size of internal kernel structures, but it's impossible for `build!` to figure that out. Therefore, `Cfg` exposes `num_task_priority_levels` method.

0 commit comments

Comments
 (0)