Skip to content

Commit 0fed3cc

Browse files
authored
doc: Adopt intra doc links (#803)
This changes the docs build to nightly, which renders intra doc links. `relay-wstring` already made use of them before, but the had not been rendered on our deployed docs.
1 parent 37fee2a commit 0fed3cc

File tree

16 files changed

+126
-143
lines changed

16 files changed

+126
-143
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ jobs:
1313
name: Cargo Docs
1414
runs-on: ubuntu-latest
1515

16+
env:
17+
RUSTDOCFLAGS: -Dbroken_intra_doc_links
18+
1619
steps:
1720
- uses: actions/checkout@v2
1821
with:
1922
submodules: recursive
2023

24+
# compile with nightly for intra-doc-links
25+
# see https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
2126
- uses: actions-rs/toolchain@v1
2227
with:
23-
toolchain: stable
28+
toolchain: nightly
2429
profile: minimal
2530
components: rust-docs
2631
override: true
@@ -29,7 +34,13 @@ jobs:
2934
with:
3035
key: ${{ github.job }}
3136

32-
- run: make doc
37+
- name: Build Docs
38+
uses: actions-rs/cargo@v1
39+
with:
40+
command: doc
41+
args: --workspace --all-features --no-deps
42+
43+
- run: echo '<meta http-equiv="refresh" content="0; url=relay/" />Redirecting to <a href="relay/">relay</a>' > target/doc/index.html
3344

3445
- name: Deploy
3546
if: github.ref == 'refs/heads/master'

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ doc: doc-api
7272
.PHONY: doc-api
7373

7474
doc-api: setup-git
75-
cargo doc --workspace --all-features --no-deps
76-
@echo '<meta http-equiv="refresh" content="0; url=relay/" />Redirecting to <a href="relay/">relay</a>' > target/doc/index.html
75+
cargo +nightly doc --workspace --all-features --no-deps
7776
.PHONY: doc-api
7877

7978
# Style checking

relay-common/src/metrics.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! ## Initializing the Client
1515
//!
1616
//! Metrics can be used without initializing a statsd client. In that case, invoking `with_client`
17-
//! or the `metric!` macro will become a noop. Only when configured, metrics will actually be
17+
//! or the [`metric!`] macro will become a noop. Only when configured, metrics will actually be
1818
//! collected.
1919
//!
2020
//! To initialize the client, either use [`set_client`] to pass a custom client, or use
@@ -58,9 +58,6 @@
5858
//! ```
5959
//!
6060
//! [Metric Types]: https://github.com/statsd/statsd/blob/master/docs/metric_types.md
61-
//! [`set_client`]: fn.set_client.html
62-
//! [`configure_statsd`]: fn.configure_statsd.html
63-
//! [`metric!`]: ../macro.metric.html
6461
6562
use std::collections::BTreeMap;
6663
use std::net::ToSocketAddrs;
@@ -158,7 +155,7 @@ pub fn configure_statsd<A: ToSocketAddrs>(
158155
/// Invoke a callback with the current statsd client.
159156
///
160157
/// If statsd is not configured the callback is not invoked. For the most part
161-
/// the `metric!` macro should be used instead.
158+
/// the [`metric!`] macro should be used instead.
162159
#[inline(always)]
163160
pub fn with_client<F, R>(f: F) -> R
164161
where
@@ -407,6 +404,8 @@ pub trait GaugeMetric {
407404
}
408405

409406
/// Emits a metric.
407+
///
408+
/// See [module-level documentation](self) for examples.
410409
#[macro_export]
411410
macro_rules! metric {
412411
// counter increment

relay-common/src/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
77
#[doc(inline)]
88
pub use sentry_types::ProjectId;
99

10-
/// An error parsing [`ProjectKey`](struct.ProjectKey.html).
10+
/// An error parsing [`ProjectKey`].
1111
#[derive(Clone, Copy, Debug)]
1212
pub struct ParseProjectKeyError;
1313

relay-ffi/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
//! ```
9999
//!
100100
//! [`errno`]: https://man7.org/linux/man-pages/man3/errno.3.html
101-
//! [`catch_unwind`]: attr.catch_unwind.html
102-
//! [`with_last_error`]: fn.with_last_error.html
103101
104102
#![warn(missing_docs)]
105103

@@ -153,9 +151,7 @@ pub mod __internal {
153151
/// Acquires a reference to the last error and passes it to the callback, if any.
154152
///
155153
/// Returns `Some(R)` if there was an error, otherwise `None`. The error resets when it is taken
156-
/// with [`take_error`].
157-
///
158-
/// [`take_error`]: fn.take_error.html
154+
/// with [`take_last_error`].
159155
///
160156
/// # Example
161157
///
@@ -184,8 +180,6 @@ where
184180
///
185181
/// To inspect the error without removing it, use [`with_last_error`].
186182
///
187-
/// [`with_last_error`]: fn.with_last_error.html
188-
///
189183
/// # Example
190184
///
191185
/// ```
@@ -210,8 +204,6 @@ pub fn take_last_error() -> Option<failure::Error> {
210204
///
211205
/// To capture panics, register the hook using [`set_panic_hook`].
212206
///
213-
/// [`set_panic_hook`]: fn.set_panic_hook.html
214-
///
215207
/// # Example
216208
///
217209
/// ```
@@ -282,7 +274,7 @@ impl Error for Panic {}
282274
/// This function must be registered early when the FFI is initialized before any other calls are
283275
/// made. Usually, this would be exported from an initialization function.
284276
///
285-
/// See the [`Panic` documentation] for more information.
277+
/// See the [`Panic`] documentation for more information.
286278
///
287279
/// # Example
288280
///
@@ -291,8 +283,6 @@ impl Error for Panic {}
291283
/// relay_ffi::set_panic_hook();
292284
/// }
293285
/// ```
294-
///
295-
/// [`Panic` documentation]: struct.Panic.html
296286
pub fn set_panic_hook() {
297287
panic::set_hook(Box::new(|info| set_last_error(Panic::new(info).into())));
298288
}

relay-filter/src/csp.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ impl From<&str> for SchemeDomainPort {
9696
/// Checks if a url satisfies one of the specified origins.
9797
///
9898
/// An origin specification may be in any of the following formats:
99-
/// - http://domain.com[:port]
99+
///
100+
/// - `http://domain.com[:port]`
100101
/// - an exact match is required
101-
/// - * : anything goes
102-
/// - *.domain.com : matches domain.com and any subdomains
103-
/// - *:port : matches any hostname as long as the port matches
102+
/// - `*`: anything goes
103+
/// - `*.domain.com`: matches domain.com and any subdomains
104+
/// - `*:port`: matches any hostname as long as the port matches
104105
pub fn matches_any_origin(url: Option<&str>, origins: &[SchemeDomainPort]) -> bool {
105106
// if we have a "*" (Any) option, anything matches so don't bother going forward
106107
if origins

relay-general/src/protocol/contexts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ pub enum Context {
577577
impl Context {
578578
/// Represents the key under which a particular context type will be inserted in a Contexts object
579579
///
580-
/// See [Contexts.add](struct.Contexts.html)
580+
/// See [`Contexts::add`]
581581
pub fn default_key(&self) -> Option<&'static str> {
582582
match &self {
583583
Context::Device(_) => Some(DeviceContext::default_key()),

relay-general/src/protocol/security_report.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ pub struct Hpkp {
814814
/// The certificate chain, as served by the Known Pinned Host during TLS session setup. It
815815
/// is provided as an array of strings; each string pem1, ... pemN is the Privacy-Enhanced Mail
816816
/// (PEM) representation of each X.509 certificate as described in [RFC7468].
817+
///
818+
/// [RFC7468]: https://tools.ietf.org/html/rfc7468
817819
pub served_certificate_chain: Annotated<Array<String>>,
818820
/// The certificate chain, as constructed by the UA during certificate chain verification.
819821
pub validated_certificate_chain: Annotated<Array<String>>,

relay-general/src/user_agent.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ pub use uaparser::{Device, UserAgent, OS};
44
use uaparser::{Parser, UserAgentParser};
55

66
lazy_static! {
7-
/// The global [`UserAgentParser`]: https://docs.rs/uap-rs/0.2.2/uap_rs/struct.UserAgentParser.html
8-
/// already configured with a user agent database.
7+
/// The global [`UserAgentParser`] already configured with a user agent database.
98
///
10-
/// For usage see [`Parser`]: https://docs.rs/uap-rs/0.2.2/uap_rs/trait.Parser.html
9+
/// For usage, see [`Parser`].
1110
static ref UA_PARSER: UserAgentParser = {
1211
let ua_regexes = include_bytes!("../uap-core/regexes.yaml");
1312
UserAgentParser::from_bytes(ua_regexes).expect(

relay-server/src/actors/connector.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Provides a metered client connector for upstream connections.
22
//!
33
//! See the [`MeteredConnector`] struct for more information.
4-
//!
5-
//! [`MeteredConnector`]: struct.MeteredConnector.html
64
75
use std::sync::Arc;
86

relay-server/src/actors/controller.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Defines an actor to control system run and shutdown.
22
//!
33
//! See the [`Controller`] struct for more information.
4-
//!
5-
//! [`Controller`]: struct.Controller.html
64
75
use std::fmt;
86
use std::time::Duration;
@@ -56,9 +54,6 @@ pub use crate::service::ServerError;
5654
/// # System::current().stop()
5755
/// })
5856
/// ```
59-
///
60-
/// [`Subscribe`]: struct.Subscribe.html
61-
/// [`Shutdown`]: struct.Shutdown.html
6257
pub struct Controller {
6358
/// Configured timeout for graceful shutdowns.
6459
timeout: Duration,
@@ -198,8 +193,6 @@ impl Handler<signal::Signal> for Controller {
198193
}
199194

200195
/// Configures the [`Controller`] with new parameters.
201-
///
202-
/// [`Controller`]: struct.Controller.html
203196
#[derive(Debug)]
204197
pub struct Configure {
205198
/// The maximum shutdown timeout before killing actors.
@@ -219,8 +212,6 @@ impl Handler<Configure> for Controller {
219212
}
220213

221214
/// Subscribtion message for [`Shutdown`] events.
222-
///
223-
/// [`Shutdown`]: struct.Shutdown.html
224215
pub struct Subscribe(pub Recipient<Shutdown>);
225216

226217
impl fmt::Debug for Subscribe {
@@ -252,8 +243,6 @@ impl Handler<Subscribe> for Controller {
252243
///
253244
/// The return value is fully ignored. It is only `Result` such that futures can be executed inside
254245
/// a handler.
255-
///
256-
/// [`Controller`]: struct.Controller.html
257246
#[derive(Debug)]
258247
pub struct Shutdown {
259248
/// The timeout for this shutdown. `None` indicates an immediate forced shutdown.

relay-server/src/actors/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl ProcessEnvelopeState {
260260
}
261261

262262
/// Synchronous service for processing envelopes.
263-
struct EventProcessor {
263+
pub struct EventProcessor {
264264
config: Arc<Config>,
265265
#[cfg(feature = "processing")]
266266
rate_limiter: Option<RedisRateLimiter>,

relay-server/src/actors/mod.rs

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
//! Defines all actors of the relay.
22
//!
3-
//! Actors require an actix system to run. The system can be started using the [`Controller`]
4-
//! actor, which will also listen for shutdown signals and trigger a graceful shutdown. Note that
5-
//! actors must implement a handler for the [`Shutdown`] message and register with the controller
6-
//! to receive this signal. See the struct level documentation for more information.
3+
//! Actors require an actix system to run. The system can be started using the
4+
//! [`Controller`](controller::Controller) actor, which will also listen for shutdown signals and
5+
//! trigger a graceful shutdown. Note that actors must implement a handler for the
6+
//! [`Shutdown`](controller::Shutdown) message and register with the controller to receive this
7+
//! signal. See the struct level documentation for more information.
78
//!
8-
//! The web server is wrapped by the [`Server`] actor. It starts the actix http web server and
9-
//! relays the graceful shutdown signal. Internally, it creates several other actors comprising the
10-
//! service state:
9+
//! The web server is wrapped by the [`Server`](server::Server) actor. It starts the actix http web
10+
//! server and relays the graceful shutdown signal. Internally, it creates several other actors
11+
//! comprising the service state:
1112
//!
12-
//! - [`ProjectCache`] and [`KeyCache`]: Two caches that serve queries for project configurations
13-
//! and relay public keys, respectively. Their requests are debounced and batched based on a
14-
//! configured interval (100ms by default). Also, missing projects and keys are cached for some
15-
//! time.
16-
//! - [`EventManager`] and [`EventProcessor`]: Handle a queue of events, verify their projects,
17-
//! execute PII stripping and finally send the event to the upstream. The processor is spawned
18-
//! in multiple synchronous worker threads (via `SyncArbiter`).
19-
//! - [`UpstreamRelay`]: Abstraction for communication with the upstream (either another Relay or
20-
//! Sentry). It manages an internal client connector to throttle requests and ensures this relay
21-
//! is authenticated before sending queries (e.g. project config or public keys).
13+
//! - [`ProjectCache`](project_cache::ProjectCache): A cache that serves queries for project
14+
//! configurations. Its requests are debounced and batched based on a configured interval (100ms
15+
//! by default). Also, missing projects are cached for some time.
16+
//! - [`EventManager`](events::EventManager) and [`EventProcessor`](events::EventProcessor): Handle
17+
//! a queue of events, verify their projects, execute PII stripping and finally send the event to
18+
//! the upstream. The processor is spawned in multiple synchronous worker threads (via
19+
//! `SyncArbiter`).
20+
//! - [`UpstreamRelay`](upstream::UpstreamRelay): Abstraction for communication with the upstream
21+
//! (either another Relay or Sentry). It manages an internal client connector to throttle
22+
//! requests and ensures this relay is authenticated before sending queries (e.g. project config
23+
//! or public keys).
2224
//!
23-
//! ### Example
25+
//! # Example
2426
//!
2527
//! ```ignore
2628
//! use relay_server::controller::Controller;
@@ -29,15 +31,6 @@
2931
//! Controller::run(|| Server::start())
3032
//! .expect("failed to start relay");
3133
//! ```
32-
//!
33-
//! [`Controller`]: controller/struct.Controller.html
34-
//! [`Shutdown`]: controller/struct.Shutdown.html
35-
//! [`Server`]: controller/struct.Server.html
36-
//! [`ProjectCache`]: controller/struct.ProjectCache.html
37-
//! [`KeyCache`]: controller/struct.KeyCache.html
38-
//! [`EventManager`]: controller/struct.EventManager.html
39-
//! [`EventProcessor`]: controller/struct.EventProcessor.html
40-
//! [`UpstreamRelay`]: controller/struct.UpstreamRelay.html
4134
4235
pub mod connector;
4336
pub mod controller;

relay-server/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
//! multiple supported endpoints, serves queries to downstream relays and send received events to
55
//! the upstream.
66
//!
7-
//! See the documentation of the `Config` struct for more information on configuration options.
8-
//!
9-
//! [`run`]: fn.run.html
7+
//! See the [`Config`] documentation for more information on configuration options.
108
#![warn(missing_docs)]
119

1210
mod actors;

0 commit comments

Comments
 (0)