Skip to content

Commit e151418

Browse files
committed
doc: document r3_core's stability
1 parent be15236 commit e151418

File tree

8 files changed

+99
-46
lines changed

8 files changed

+99
-46
lines changed

src/r3/src/lib.md

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,78 @@ body.theme-ayu h1 img:nth-of-type(1) { filter: brightness(8) hue-rotate(-120deg)
1818

1919
See [`r3_core`]'s crate-level documentation for a general description of kernel features and concepts used in R3.
2020

21+
<!-- Display a "some Cargo features are disabled" warning in the documentation so that the user can know some items are missing for that reason. But we don't want this message to be displayed when someone is viewing `lib.md` directly, so the actual message is rendered by CSS. -->
22+
<div class="admonition-follows"></div>
23+
<blockquote class="disabled-feature-warning"><p><span></span><code></code></p></blockquote>
24+
2125
# Package Ecosystem
2226

23-
The `r3` package is built on top on [`r3_core`] and provides useful abstractions. A kernel, which is chosen by application code, is implemented for a specific major version of `r3_core` and not others. Separating the fast-changing part into `r3` prevents ecosystem split and maximizes code reuse.
24-
25-
<table class="package-ecosystem-table" align="center">
26-
<tr>
27-
<th>Application code</th>
28-
<td colspan="2">Application</td>
29-
<td colspan="2">Library</td>
30-
<td colspan="2">Library</td>
31-
<td class="noborder">...</td>
32-
</tr>
33-
<tr>
34-
<th>Façade API</th>
35-
<td colspan="3"><code>r3 1.0¹</code></td>
36-
<td colspan="3"><code>r3 2.0</code></td>
37-
<td class="noborder">...</td>
38-
</tr>
39-
<tr>
40-
<th>Core API definition</th>
41-
<td colspan="7"><code>r3_core 1.0</code></td>
42-
</tr>
43-
<tr>
44-
<th>Kernel (API implementor)²</th>
45-
<td colspan="7"><code>r3_kernel</code></td>
46-
</tr>
47-
<tr>
48-
<th>Ports²</th>
49-
<td colspan="2"><code>r3_port_std</code></td>
50-
<td colspan="2"><code>r3_port_arm</code></td>
51-
<td colspan="2"><code>r3_port_arm_m</code></td>
52-
<td><code>r3_port_riscv</code></td>
53-
</tr>
54-
</table>
27+
The R3 ecosystem revolves around the [`r3_core`][] package. Applications and libraries, including this `r3` package, are built on top of `r3_core`'s application-side API. This is in contrast with the kernel-side API, which intentionally has a weaker [stability guarantee] for continuous optimization and improvement.
28+
29+
The following diagram shows a possible package configuration of an R3 application.
30+
31+
<div class="package-ecosystem-table-wrap">
32+
<table class="package-ecosystem-table" align="center">
33+
<tr>
34+
<th>Application code</th>
35+
<td colspan="2">Application</td>
36+
<td colspan="2">Library</td>
37+
<td colspan="2">Library</td>
38+
<td class="noborder">...</td>
39+
</tr>
40+
<tr>
41+
<th>Façade API</th>
42+
<td colspan="3"><code>r3 1.0¹</code></td>
43+
<td colspan="3"><code>r3 2.0</code></td>
44+
<td class="noborder">...</td>
45+
</tr>
46+
<tr>
47+
<th>Core API definition</th>
48+
<td colspan="7"><code>r3_core 1.0</code></td>
49+
</tr>
50+
<tr>
51+
<th>Kernel (API implementor)²</th>
52+
<td colspan="7"><code>r3_kernel</code></td>
53+
</tr>
54+
<tr>
55+
<th>Ports²</th>
56+
<td colspan="7"><code>r3_port_std</code> || <code>_arm</code> || <code>_arm_m</code> || <code>_riscv</code></td>
57+
</tr>
58+
</table>
59+
</div>
5560

5661
<sub>¹ Version numbers shown here are illustrative.</sub>
5762

5863
<sub>² Application code chooses kernel and port implementations.</sub>
5964

6065
<style type="text/css">
61-
.package-ecosystem-table { border-collapse: separate; border-spacing: 5px !important; }
66+
.package-ecosystem-table-wrap { text-align: center; }
67+
.package-ecosystem-table {
68+
border-collapse: separate; border-spacing: 5px !important;
69+
margin: 0.5em auto !important; width: auto !important; display: inline-block !important;
70+
padding-right: 0.5em;
71+
}
6272
.package-ecosystem-table td { border: 0.5px currentColor solid !important; text-align: center; vertical-align: middle }
6373
.package-ecosystem-table td.noborder,
64-
.package-ecosystem-table th { border: none !important; }
74+
.package-ecosystem-table th { border: none !important; font-weight: normal; }
6575
</style>
6676

6777
<div class="admonition-follows"></div>
6878

6979
> **Notes:** Many items of this crate are re-exported from [`r3_core`][], and consequently their example code refers to them through paths starting with `r3_core::`. You can replace them with `r3::` in your application code.
7080
71-
<!-- Display a "some Cargo features are disabled" warning in the documentation so that the user can know some items are missing for that reason. But we don't want this message to be displayed when someone is viewing `lib.md` directly, so the actual message is rendered by CSS. -->
72-
<div class="admonition-follows"></div>
73-
<blockquote class="disabled-feature-warning"><p><span></span><code></code></p></blockquote>
81+
[stability guarantee]: r3_core#stability
82+
83+
84+
# Stability
85+
86+
This package is versioned in accordance with [the Semantic Versioning 2.0.0][]. Requiring a newer version of [`r3_core`][] that breaks [the application-side API stability guarantee][] is considered a breaking change.
87+
88+
Increasing the minimum supported Rust version (MSRV) is not considered a breaking change.
89+
90+
[the Semantic Versioning 2.0.0]: https://semver.org/
91+
[the application-side API stability guarantee]: r3_core#stability
92+
7493

7594
# Cargo Features
7695

src/r3/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ mod tests;
6262
pub use r3_core::{bag, hunk, kernel, time};
6363

6464
/// Utilities. This module re-exports items from [`r3_core::utils`] that are
65-
/// subject to the application-side API stability guarantee.
65+
/// subject to [the application-side API stability guarantee][1].
66+
///
67+
/// [1]: r3_core#stability
6668
pub mod utils {
6769
pub use r3_core::utils::{Init, ZeroInit};
6870
}

src/r3_core/src/kernel/raw_cfg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
2929
//!
3030
//! # Stability
3131
//!
32-
//! This module is covered by the kernel-side API stability guarantee.
32+
//! This module is covered by [the kernel-side API stability guarantee][2].
3333
//!
3434
//! The trait paths in this module are covered by the application-side API
3535
//! stability guarantee. Application code should only use these traits in trait
3636
//! bounds and, to access the provided functionalities, should use the the
3737
//! stable wrapper [outside this module](../index.html) instead.
3838
//!
3939
//! [1]: crate::kernel::cfg::KernelStatic
40+
//! [2]: crate#stability
4041
use crate::{bag::Bag, closure::Closure, kernel::raw, time::Duration, utils::PhantomInvariant};
4142

4243
/// The trait for all kernel-specific low-level configurator types, used by

src/r3_core/src/lib.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The core API represents the low-level interface between kernel and application c
2424
- [Interrupt Handling Framework](#interrupt-handling-framework)
2525
- [Kernel Timing](#kernel-timing)
2626
- [Introspection](#introspection)
27+
- [Stability](#stability)
2728
- [Cargo Features](#cargo-features)
2829
- [Modules](#modules) <!-- this section is generated by rustdoc -->
2930
- [Macros](#macros) <!-- this section is generated by rustdoc -->
@@ -641,6 +642,24 @@ Kernel {
641642

642643
</details>
643644

645+
646+
# Stability
647+
648+
`r3_core` defines two levels of API stability:
649+
650+
- **The application-side API stability** applies to the API used by application code.
651+
652+
- **The kernel-side API stability** applies to the API used by a kernel implementation. The API coverage is strictly larger because a kernel implementation may use the application-side API as well, e.g., to install an interrupt handler for its own kernel timing mechanism.
653+
654+
All public and documented items are covered under the application-side API stability unless noted otherwise.
655+
656+
This release of R3-OS is considered a preview version. During the preview period, `r3_core` follows [the Semantic Versioning 2.0.0][] and considers breaking either level of stability as a breaking change. It's being planned to introduce a versioning scheme that maps each stability level to a distinct version component so that the kernel-side API can be extended substantially while maintaining compatibility with existing application and library code.
657+
658+
Increasing the minimum supported Rust version (MSRV) is not considered a breaking change.
659+
660+
[the Semantic Versioning 2.0.0]: https://semver.org/
661+
662+
644663
# Cargo Features
645664

646665
- **`chrono_0p4`**: Enables conversion between our [duration] and [timetamp] types and `chrono ^0.4`'s types.

src/r3_core/src/utils/alloc.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ macro_rules! const_try_result {
1616
///
1717
/// # Stability
1818
///
19-
/// This type is subject to the kernel-side API stability guarantee.
19+
/// This type is subject to [the kernel-side API stability guarantee][1].
20+
///
21+
/// [1]: crate#stability
2022
pub struct ConstAllocator {
2123
// We very much want to put these in `core::cell::*`, but they aren't very
2224
// useful in `const fn`, unfortunately.
@@ -210,7 +212,9 @@ impl const Drop for ConstAllocator {
210212
///
211213
/// # Stability
212214
///
213-
/// This trait is subject to the kernel-side API stability guarantee.
215+
/// This trait is subject to [the kernel-side API stability guarantee][1].
216+
///
217+
/// [1]: crate#stability
214218
#[derive(Clone, Copy)]
215219
pub struct AllocError;
216220

@@ -222,7 +226,9 @@ pub struct AllocError;
222226
///
223227
/// # Stability
224228
///
225-
/// This trait is subject to the kernel-side API stability guarantee.
229+
/// This trait is subject to [the kernel-side API stability guarantee][1].
230+
///
231+
/// [1]: crate#stability
226232
pub unsafe trait Allocator {
227233
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;
228234

src/r3_core/src/utils/init.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use core::{
99
/// Trait for types having a constant default value. This is essentially a
1010
/// constant version of `Default`.
1111
///
12-
/// This trait is subject to the API stability guarantee.
12+
/// This trait is subject to [the application-side API stability guarantee][1].
13+
///
14+
/// [1]: crate#stability
1315
pub trait Init {
1416
/// The default value.
1517
const INIT: Self;

src/r3_core/src/utils/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! Utility
22
//!
3-
//! **This module is exempt from the API stability guarantee** unless specified
4-
//! otherwise. It's exposed mostly because it's needed by macros.
3+
//! **This module is exempt from [the API stability guarantee][1]** unless
4+
//! specified otherwise. It's exposed mostly because it's needed by macros.
5+
//!
6+
//! [1]: crate#stability
57
use core::marker::PhantomData;
68

79
/// Conditional type

src/r3_core/src/utils/zeroinit.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ use core::{cell::UnsafeCell, mem, sync::atomic};
22

33
/// Trait for zero-initializable types.
44
///
5-
/// This trait is subject to the API stability guarantee.
5+
/// This trait is subject to [the application-side API stability guarantee][1].
66
///
77
/// # Safety
88
///
99
/// Zero-initialization is not safe for all types. For example, references
1010
/// (`&_`)
11+
///
12+
/// [1]: crate#stability
1113
pub unsafe trait ZeroInit {}
1214

1315
unsafe impl<T> ZeroInit for atomic::AtomicPtr<T> {}

0 commit comments

Comments
 (0)