Skip to content

Commit b0c5a9d

Browse files
authored
docs: add Netlify auto-publishing of main API docs (console-rs#116)
This branch configures Netlify to automatically build and publish the API docs for the `main` branch. This is particularly useful right now, since the console hasn't been published to `crates.io`, so we don't have docs.rs docs to refer people to yet. A deploy preview is also generated for every pull request against `main`, so we can preview the new docs added in PRs. Since I configured the Netlify docs build to deny RustDoc warnings, I also had to fix a couple broken links in the current docs. The `console` crate's docs are built with private items included. This is because the `console` application is a binary rather than a library, and will probably never be published as a lib. Those docs should be thought of as internal development docs, rather than user-facing API reference docs. Signed-off-by: Eliza Weisman <[email protected]>
1 parent e2a1774 commit b0c5a9d

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# tokio-console prototypes
22

3+
[![API Documentation (`main`)](https://img.shields.io/netlify/0e5ffd50-e1fa-416e-b147-a04dab28cfb1?label=docs%20%28main%29)][main-docs]
4+
35
⚠️ **extremely serious warning:** this is _pre-alpha_, proof-of-concept
46
software! currently, the wire format has _no stability guarantees_ &mdash;
57
the crates in this repository are not guaranteed to be interoperable except
68
within the same Git revision. when these crates are published to crates.io, the
79
wire format will follow semver, but currently, anything could happen!
810

11+
[API Documentation (`main` branch)][main-docs]
12+
13+
[main-docs]: https://tokio-console.netlify.app
14+
915
## what's all this, then?
1016

1117
this repository contains a prototype implementation of TurboWish/tokio-console,

console-subscriber/src/init.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ pub fn init() {
5050
/// and a [filter] that enables the spans and events required by the console.
5151
///
5252
/// Unlike [`init`], this function does not set the default subscriber, allowing
53-
/// additional [`Layer`s] to be added.
53+
/// additional [`Layer`]s to be added.
5454
///
5555
/// [subscriber]: https://docs.rs/tracing/latest/tracing/subscriber/trait.Subscriber.html
5656
/// [filter]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html
57+
/// [`Layer`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/trait.Layer.html
5758
///
5859
/// ## Configuration
5960
///
@@ -62,9 +63,8 @@ pub fn init() {
6263
///
6364
/// ## Differences from `init`
6465
///
65-
/// You must call
66-
/// [`init`][tracing_subscriber::util::SubscriberInitExt::init] on the
67-
/// final layer in order to register the subscriber.
66+
/// You must call [`.init()`] on the final subscriber in order to [set the
67+
/// subscriber as the default][set_default].
6868
///
6969
/// ## Examples
7070
///
@@ -75,7 +75,8 @@ pub fn init() {
7575
/// // .with(...)
7676
/// .init();
7777
/// ```
78-
78+
/// [`.init()`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/util/trait.SubscriberInitExt.html
79+
/// [set_default]: https://docs.rs/tracing/latest/tracing/subscriber/fn.set_default.html
7980
#[must_use = "build() without init() will not set the default tracing subscriber"]
8081
pub fn build() -> ConsoleSubscriberLayer {
8182
let (layer, server) = TasksLayer::builder().with_default_env().build();

console/src/view/mini_histogram.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use tui::{
99

1010
/// This is a tui-rs widget to visualize a latency histogram in a small area.
1111
/// It is based on the [`Sparkline`] widget, so it draws a mini bar chart with
12-
/// some labels for clarity. Unlike Sparkline, it does not omit very small values.
12+
/// some labels for clarity. Unlike Sparkline, it does not omit very small
13+
/// values.
14+
///
15+
/// [`Sparkline`]: tui::widgets::Sparkline
1316
pub(crate) struct MiniHistogram<'a> {
1417
/// A block to wrap the widget in
1518
block: Option<Block<'a>>,

netlify.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[build]
2+
command = """
3+
rustup install nightly --profile minimal \
4+
&& cargo doc --no-deps --all-features -p console-subscriber -p console-api \
5+
&& cargo doc --no-deps --all-features --document-private-items -p console
6+
"""
7+
environment = { RUSTDOCFLAGS= "--cfg docsrs -D warnings" }
8+
publish = "target/doc"
9+
10+
[[redirects]]
11+
from = "/"
12+
to = "/console_subscriber"

0 commit comments

Comments
 (0)