From 1c0c8ed5295583d16e40533062a37346e414fdcb Mon Sep 17 00:00:00 2001 From: Serge Barral Date: Sun, 8 Sep 2024 17:31:39 +0200 Subject: [PATCH 1/2] Add automatic feature documentation for docs.rs --- .github/workflows/ci.yml | 2 ++ asynchronix/Cargo.toml | 4 ++++ asynchronix/src/lib.rs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1c0f5d..9c9f013 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,3 +163,5 @@ jobs: - name: Run cargo doc run: cargo doc --no-deps --all-features --document-private-items + env: + RUSTDOCFLAGS: --cfg docsrs -Dwarnings diff --git a/asynchronix/Cargo.toml b/asynchronix/Cargo.toml index a9f0856..e58a520 100644 --- a/asynchronix/Cargo.toml +++ b/asynchronix/Cargo.toml @@ -71,6 +71,10 @@ tonic-build = { version = "0.12" } # `asynchronix_grpc_codegen` flag: regenerate gRPC code from .proto definitions. unexpected_cfgs = { level = "warn", check-cfg = ['cfg(asynchronix_loom)', 'cfg(asynchronix_grpc_codegen)'] } +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [[test]] name = "integration" path = "tests/tests.rs" diff --git a/asynchronix/src/lib.rs b/asynchronix/src/lib.rs index ffa8139..10333cb 100644 --- a/asynchronix/src/lib.rs +++ b/asynchronix/src/lib.rs @@ -406,6 +406,8 @@ //! * the [`time`] module discusses in particular the monotonic timestamp format //! used for simulations ([`time::MonotonicTime`]). #![warn(missing_docs, missing_debug_implementations, unreachable_pub)] +#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide))] +#![cfg_attr(docsrs, doc(cfg_hide(feature = "dev-hooks")))] pub(crate) mod channel; pub(crate) mod executor; From 2a8a3738cbccbd415a153cae8b4298e7c4150a9f Mon Sep 17 00:00:00 2001 From: Serge Barral Date: Sun, 8 Sep 2024 17:38:58 +0200 Subject: [PATCH 2/2] Use better supported UTF symbols for arrow heads --- README.md | 2 +- asynchronix/examples/assembly.rs | 2 +- asynchronix/examples/espresso_machine.rs | 10 +++++----- asynchronix/examples/external_input.rs | 2 +- asynchronix/examples/power_supply.rs | 12 ++++++------ asynchronix/examples/stepper_motor.rs | 2 +- asynchronix/src/lib.rs | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e2f8644..abc5fc8 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ asynchronix = "0.2.2" // // ┌──────────────┐ ┌──────────────┐ // │ │ │ │ -// Input ●─────▶│ multiplier 1 ├─────▶│ multiplier 2 ├─────▶ Output +// Input ●─────►│ multiplier 1 ├─────►│ multiplier 2 ├─────► Output // │ │ │ │ // └──────────────┘ └──────────────┘ use asynchronix::model::{Model, Output}; diff --git a/asynchronix/examples/assembly.rs b/asynchronix/examples/assembly.rs index ccc2eb3..3445d68 100644 --- a/asynchronix/examples/assembly.rs +++ b/asynchronix/examples/assembly.rs @@ -15,7 +15,7 @@ //! │ Assembly │ //! │ ┌──────────┐ ┌──────────┐ │ //! PPS │ │ │ coil currents │ │ │position -//! Pulse rate ●───────▶│──▶│ Driver ├───────────────▶│ Motor ├──▶│─────────▶ +//! Pulse rate ●───────►│──►│ Driver ├───────────────►│ Motor ├──►│─────────► //! (±freq)│ │ │ (IA, IB) │ │ │(0:199) //! │ └──────────┘ └──────────┘ │ //! └──────────────────────────────────────────────┘ diff --git a/asynchronix/examples/espresso_machine.rs b/asynchronix/examples/espresso_machine.rs index f5b90da..e8f9be2 100644 --- a/asynchronix/examples/espresso_machine.rs +++ b/asynchronix/examples/espresso_machine.rs @@ -12,9 +12,9 @@ //! ┌─────────────────────────────────────────────┐ //! │ (≥0) │ //! │ ┌────────────┐ │ -//! └───▶│ │ │ +//! └───►│ │ │ //! added volume │ Water tank ├────┐ │ -//! Water fill ●───────────────────▶│ │ │ │ +//! Water fill ●───────────────────►│ │ │ │ //! (>0) └────────────┘ │ │ //! │ │ //! water sense │ │ @@ -22,9 +22,9 @@ //! │ (empty|not empty) │ //! │ │ //! │ ┌────────────┐ ┌────────────┐ │ -//! brew time └───▶│ │ command │ │ │ -//! Brew time dial ●───────────────────▶│ Controller ├─────────▶│ Water pump ├───┘ -//! (>0) ┌───▶│ │ (on|off) │ │ +//! brew time └───►│ │ command │ │ │ +//! Brew time dial ●───────────────────►│ Controller ├─────────►│ Water pump ├───┘ +//! (>0) ┌───►│ │ (on|off) │ │ //! │ └────────────┘ └────────────┘ //! trigger │ //! Brew command ●───────────────┘ diff --git a/asynchronix/examples/external_input.rs b/asynchronix/examples/external_input.rs index 1f0f434..0cd1dd0 100644 --- a/asynchronix/examples/external_input.rs +++ b/asynchronix/examples/external_input.rs @@ -11,7 +11,7 @@ //! │ Simulation │ //! ┌────────────┐ ┌────────────┐ │ ┌──────────┐ │ //! │ │ UDP │ │ message │ message │ │ message │ ┌─────────────┐ -//! │ UDP Client ├─────────▶│ UDP Server ├──────────▶├─────────▶│ Listener ├─────────▶├──▶│ EventBuffer │ +//! │ UDP Client ├─────────►│ UDP Server ├──────────►├─────────►│ Listener ├─────────►├──►│ EventBuffer │ //! │ │ message │ │ │ │ │ │ └─────────────┘ //! └────────────┘ └────────────┘ │ └──────────┘ │ //! └────────────────────────────────┘ diff --git a/asynchronix/examples/power_supply.rs b/asynchronix/examples/power_supply.rs index ab694bf..52377b6 100644 --- a/asynchronix/examples/power_supply.rs +++ b/asynchronix/examples/power_supply.rs @@ -8,22 +8,22 @@ //! ```text //! ┌────────┐ //! │ │ -//! ┌───▶│ Load ├───▶ Power +//! ┌───►│ Load ├───► Power //! │ │ │ //! │ └────────┘ //! │ //! │ ┌────────┐ //! │ │ │ -//! ├───▶│ Load ├───▶ Power +//! ├───►│ Load ├───► Power //! │ │ │ //! │ └────────┘ //! │ //! │ ┌────────┐ -//! ┌──────────┐ voltage▶ │ │ │ -//! Voltage setting ●────▶│ │◀────────────┴───▶│ Load ├───▶ Power -//! │ Power │ ◀current │ │ +//! ┌──────────┐ voltage► │ │ │ +//! Voltage setting ●────►│ │◄────────────┴───►│ Load ├───► Power +//! │ Power │ ◄current │ │ //! │ supply │ └────────┘ -//! │ ├───────────────────────────────▶ Total power +//! │ ├───────────────────────────────► Total power //! └──────────┘ //! ``` use asynchronix::model::Model; diff --git a/asynchronix/examples/stepper_motor.rs b/asynchronix/examples/stepper_motor.rs index 867f46b..0e175ed 100644 --- a/asynchronix/examples/stepper_motor.rs +++ b/asynchronix/examples/stepper_motor.rs @@ -9,7 +9,7 @@ //! ```text //! ┌──────────┐ ┌──────────┐ //! PPS │ │ coil currents │ │ position -//! Pulse rate ●─────────▶│ Driver ├───────────────▶│ Motor ├──────────▶ +//! Pulse rate ●─────────►│ Driver ├───────────────►│ Motor ├──────────► //! (±freq) │ │ (IA, IB) │ │ (0:199) //! └──────────┘ └──────────┘ //! ``` diff --git a/asynchronix/src/lib.rs b/asynchronix/src/lib.rs index 10333cb..f8aba7f 100644 --- a/asynchronix/src/lib.rs +++ b/asynchronix/src/lib.rs @@ -75,7 +75,7 @@ //! ```text //! ┌────────────┐ //! │ │ -//! Input ●───────▶│ Multiplier ├───────▶ Output +//! Input ●───────►│ Multiplier ├───────► Output //! f64 │ │ f64 //! └────────────┘ //! ``` @@ -156,13 +156,13 @@ //! ```text //! ┌────────────┐ //! │ │ -//! ┌──▶│ Delay ├──┐ +//! ┌──►│ Delay ├──┐ //! ┌────────────┐ │ │ │ │ ┌────────────┐ //! │ │ │ └────────────┘ │ │ │ -//! Input ●──▶│ Multiplier ├───┤ ├──▶│ Delay ├──▶ Output +//! Input ●──►│ Multiplier ├───┤ ├──►│ Delay ├──► Output //! │ │ │ ┌────────────┐ │ │ │ //! └────────────┘ │ │ │ │ └────────────┘ -//! └──▶│ Multiplier ├──┘ +//! └──►│ Multiplier ├──┘ //! │ │ //! └────────────┘ //! ```