Skip to content

Commit 28f2a33

Browse files
committed
Use inter/intra-crate links in all documentation.
1 parent 2839aca commit 28f2a33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+484
-544
lines changed

contrib/lib/src/databases.rs

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
//! support can be easily extended by implementing the [`Poolable`] trait. See
2727
//! [Extending](#extending) for more.
2828
//!
29-
//! [`r2d2`]: https://crates.io/crates/r2d2
30-
//! [request guards]: [rocket::FromRequest]
31-
//!
3229
//! ## Example
3330
//!
3431
//! Before using this library, the feature corresponding to your database type
@@ -204,8 +201,6 @@
204201
//! generates an implementation of the [`Deref`](::std::ops::Deref) trait with
205202
//! the internal `Poolable` type as the target.
206203
//!
207-
//! [`FromRequest`]: /rocket/request/trait.FromRequest.html
208-
//!
209204
//! The macro will also generate two inherent methods on the decorated type:
210205
//!
211206
//! * `fn fairing() -> impl Fairing`
@@ -316,14 +311,14 @@
316311
//! The list below includes all presently supported database adapters and their
317312
//! corresponding [`Poolable`] type.
318313
//!
319-
//! | Kind | Driver | [`Poolable`] Type | Feature |
314+
//! | Kind | Driver | `Poolable` Type | Feature |
320315
//! |----------|-----------------------|--------------------------------|------------------------|
321316
//! | MySQL | [Diesel] | [`diesel::MysqlConnection`] | `diesel_mysql_pool` |
322-
//! | MySQL | [`rust-mysql-simple`] | [`mysql::conn`] | `mysql_pool` |
317+
//! | MySQL | [`rust-mysql-simple`] | [`mysql::Conn`] | `mysql_pool` |
323318
//! | Postgres | [Diesel] | [`diesel::PgConnection`] | `diesel_postgres_pool` |
324319
//! | Postgres | [Rust-Postgres] | [`postgres::Connection`] | `postgres_pool` |
325320
//! | Sqlite | [Diesel] | [`diesel::SqliteConnection`] | `diesel_sqlite_pool` |
326-
//! | Sqlite | [`Rustqlite`] | [`rusqlite::Connection`] | `sqlite_pool` |
321+
//! | Sqlite | [Rustqlite] | [`rusqlite::Connection`] | `sqlite_pool` |
327322
//! | Neo4j | [`rusted_cypher`] | [`rusted_cypher::GraphClient`] | `cypher_pool` |
328323
//! | Redis | [`redis-rs`] | [`redis::Connection`] | `redis_pool` |
329324
//!
@@ -338,7 +333,7 @@
338333
//! [`diesel::MysqlConnection`]: http://docs.diesel.rs/diesel/mysql/struct.MysqlConnection.html
339334
//! [`redis-rs`]: https://github.com/mitsuhiko/redis-rs
340335
//! [`rusted_cypher`]: https://github.com/livioribeiro/rusted-cypher
341-
//! [`Rustqlite`]: https://github.com/jgallagher/rusqlite
336+
//! [Rustqlite]: https://github.com/jgallagher/rusqlite
342337
//! [Rust-Postgres]: https://github.com/sfackler/rust-postgres
343338
//! [`rust-mysql-simple`]: https://github.com/blackbeam/rust-mysql-simple
344339
//! [`diesel::PgConnection`]: http://docs.diesel.rs/diesel/pg/struct.PgConnection.html
@@ -355,6 +350,10 @@
355350
//! database-like struct that can be pooled by `r2d2`) is as easy as
356351
//! implementing the [`Poolable`] trait. See the documentation for [`Poolable`]
357352
//! for more details on how to implement it.
353+
//!
354+
//! [`FromRequest`]: rocket::FromRequest
355+
//! [request guards]: rocket::FromRequest
356+
//! [`Poolable`]: databases::Poolable
358357
359358
pub extern crate r2d2;
360359

@@ -455,7 +454,7 @@ pub enum DatabaseConfigError {
455454
/// configuration.
456455
MissingKey,
457456
/// The configuration associated with the key isn't a
458-
/// [Table](/rocket/config/type.Table.html).
457+
/// [Table](::rocket::config::Table).
459458
MalformedConfiguration,
460459
/// The required `url` key is missing.
461460
MissingUrl,
@@ -612,20 +611,16 @@ impl<'a> Display for DatabaseConfigError {
612611
/// `foo::ConnectionManager`
613612
/// * `foo::Error`, errors resulting from manager instantiation
614613
///
615-
/// [`r2d2`]: https://crates.io/crates/r2d2
616-
/// [`r2d2::ManageConnection`]: http://docs.rs/r2d2/0.8/r2d2/trait.ManageConnection.html
617-
///
618614
/// In order for Rocket to generate the required code to automatically provision
619615
/// a r2d2 connection pool into application state, the `Poolable` trait needs to
620616
/// be implemented for the connection type. The following example implements
621617
/// `Poolable` for `foo::Connection`:
622618
///
623619
/// ```rust
624620
/// use rocket_contrib::databases::{r2d2, DbError, DatabaseConfig, Poolable};
625-
///
626621
/// # mod foo {
627-
/// # use rocket_contrib::databases::r2d2;
628622
/// # use std::fmt;
623+
/// # use rocket_contrib::databases::r2d2;
629624
/// # #[derive(Debug)] pub struct Error;
630625
/// # impl ::std::error::Error for Error { }
631626
/// # impl fmt::Display for Error {
@@ -637,6 +632,10 @@ impl<'a> Display for DatabaseConfigError {
637632
/// #
638633
/// # type Result<T> = ::std::result::Result<T, Error>;
639634
/// #
635+
/// # impl ConnectionManager {
636+
/// # pub fn new(url: &str) -> Result<Self> { Err(Error) }
637+
/// # }
638+
/// #
640639
/// # impl self::r2d2::ManageConnection for ConnectionManager {
641640
/// # type Connection = Connection;
642641
/// # type Error = Error;
@@ -651,16 +650,13 @@ impl<'a> Display for DatabaseConfigError {
651650
/// type Error = DbError<foo::Error>;
652651
///
653652
/// fn pool(config: DatabaseConfig) -> Result<r2d2::Pool<Self::Manager>, Self::Error> {
654-
/// # let _ = config; /*
655653
/// let manager = foo::ConnectionManager::new(config.url)
656654
/// .map_err(DbError::Custom)?;
657655
///
658656
/// r2d2::Pool::builder()
659657
/// .max_size(config.pool_size)
660658
/// .build(manager)
661659
/// .map_err(DbError::PoolError)
662-
/// # */
663-
/// # Err(DbError::Custom(foo::Error))
664660
/// }
665661
/// }
666662
/// ```

contrib/lib/src/json.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ impl<T> DerefMut for Json<T> {
164164
/// this type implements [`Responder`], allowing a value of this type to be
165165
/// returned directly from a handler.
166166
///
167-
/// [`Value`]: https://docs.rs/serde_json/1.0.2/serde_json/value/enum.Value.html
168-
/// [`Responder`]: /rocket/response/trait.Responder.html
167+
/// [`Value`]: serde_json::value
168+
/// [`Responder`]: rocket::response::Responder
169169
///
170170
/// # `Responder`
171171
///
@@ -175,16 +175,18 @@ impl<T> DerefMut for Json<T> {
175175
///
176176
/// # Usage
177177
///
178-
/// A value of this type is constructed via the
179-
/// [`json!`](/rocket_contrib/macro.json.html) macro. The macro and this type
180-
/// are typically used to construct JSON values in an ad-hoc fashion during
181-
/// request handling. This looks something like:
178+
/// A value of this type is constructed via the [`json!`](json) macro. The macro
179+
/// and this type are typically used to construct JSON values in an ad-hoc
180+
/// fashion during request handling. This looks something like:
182181
///
183-
/// ```rust,ignore
182+
/// ```rust
183+
/// # #![feature(proc_macro_hygiene, decl_macro)]
184+
/// # #[macro_use] extern crate rocket;
185+
/// # #[macro_use] extern crate rocket_contrib;
184186
/// use rocket_contrib::JsonValue;
185187
///
186-
/// #[get("/item")]
187-
/// fn get_item() -> JsonValue {
188+
/// #[get("/json")]
189+
/// fn get_json() -> JsonValue {
188190
/// json!({
189191
/// "id": 83,
190192
/// "values": [1, 2, 3, 4]
@@ -259,15 +261,17 @@ impl<'a> Responder<'a> for JsonValue {
259261
/// To import the macro, add the `#[macro_use]` attribute to the `extern crate
260262
/// rocket_contrib` invocation:
261263
///
262-
/// ```rust,ignore
264+
/// ```rust
263265
/// #[macro_use] extern crate rocket_contrib;
264266
/// ```
265267
///
266-
/// The return type of a `json!` invocation is
267-
/// [`JsonValue`](/rocket_contrib/struct.JsonValue.html). A value created with
268-
/// this macro can be returned from a handler as follows:
268+
/// The return type of a `json!` invocation is [`JsonValue`]. A value created
269+
/// with this macro can be returned from a handler as follows:
269270
///
270-
/// ```rust,ignore
271+
/// ```rust
272+
/// # #![feature(proc_macro_hygiene, decl_macro)]
273+
/// # #[macro_use] extern crate rocket;
274+
/// # #[macro_use] extern crate rocket_contrib;
271275
/// use rocket_contrib::JsonValue;
272276
///
273277
/// #[get("/json")]

contrib/lib/src/lib.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,26 @@
1010
//!
1111
//! These libraries are always kept in-sync with the core Rocket library. They
1212
//! provide common, but not fundamental, abstractions to be used by Rocket
13-
//! applications. In particular, contributor libraries typically export types
14-
//! implementing a combination of the `FromRequest`, `FromParam`, and
15-
//! `Responder` traits.
13+
//! applications.
1614
//!
1715
//! Each module in this library is held behind a feature flag, with the most
1816
//! common modules exposed by default. The present feature list is below, with
1917
//! an asterisk next to the features that are enabled by default:
2018
//!
21-
//! * [json*](struct.Json.html)
19+
//! * [json*](Json)
2220
//! * [static_files*](static_files)
23-
//! * [msgpack](struct.MsgPack.html)
24-
//! * [handlebars_templates](struct.Template.html)
25-
//! * [tera_templates](struct.Template.html)
26-
//! * [uuid](struct.Uuid.html)
27-
//! * [${database}_pool](databases/index.html)
21+
//! * [msgpack](MsgPack)
22+
//! * [handlebars_templates](Template)
23+
//! * [tera_templates](Template)
24+
//! * [uuid](Uuid)
25+
//! * [${database}_pool](databases)
2826
//!
2927
//! The recommend way to include features from this crate via Cargo in your
3028
//! project is by adding a `[dependencies.rocket_contrib]` section to your
3129
//! `Cargo.toml` file, setting `default-features` to false, and specifying
3230
//! features manually. For example, to use the JSON module, you would add:
3331
//!
34-
//! ```toml,ignore
32+
//! ```toml
3533
//! [dependencies.rocket_contrib]
3634
//! version = "*"
3735
//! default-features = false

contrib/lib/src/templates/engine.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,23 @@ pub trait Engine: Send + Sync + 'static {
4040
/// });
4141
/// ```
4242
///
43-
/// [`tera::Value`]: https://docs.rs/tera/0.10.10/tera/enum.Value.html
44-
/// [`tera::Result`]: https://docs.rs/tera/0.10.10/tera/type.Result.html
43+
/// [`tera::Value`]: ::tera::Value
44+
/// [`tera::Result`]: ::tera::Result
4545
pub struct Engines {
4646
#[cfg(feature = "tera_templates")]
4747
/// A [`Tera`] structure. This field is only available when the
4848
/// `tera_templates` feature is enabled. When calling methods on the `Tera`
4949
/// instance, ensure you use types imported from `rocket_contrib::tera` to
5050
/// avoid version mismatches.
5151
///
52-
/// [`Tera`]: https://docs.rs/tera/0.10.10/tera/struct.Tera.html
52+
/// [`Tera`]: tera::Tera
5353
pub tera: Tera,
5454
/// A [`Handlebars`] structure. This field is only available when the
5555
/// `handlebars_templates` feature is enabled. When calling methods on the
5656
/// `Tera` instance, ensure you use types
5757
/// imported from `rocket_contrib::handlebars` to avoid version mismatches.
5858
///
59-
/// [`Handlebars`]:
60-
/// https://docs.rs/handlebars/0.29.1/handlebars/struct.Handlebars.html
59+
/// [`Handlebars`]: handlebars::Handlebars
6160
#[cfg(feature = "handlebars_templates")]
6261
pub handlebars: Handlebars,
6362
}

contrib/lib/src/templates/metadata.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use rocket::request::{self, FromRequest};
44

55
use super::ContextManager;
66

7-
/// The `TemplateMetadata` type: implements `FromRequest`, allowing dynamic
8-
/// queries about template metadata.
7+
/// Implements [`FromRequest`] for dynamiclly querying template metadata.
98
///
109
/// # Usage
1110
///
12-
/// First, ensure that the template [fairing](`rocket::fairing`),
13-
/// [`Template::fairing()`] is attached to your Rocket application:
11+
/// First, ensure that the template [fairing](rocket::fairing),
12+
/// [`Template::fairing()`](::Template::fairing()) is attached to your Rocket
13+
/// application:
1414
///
1515
/// ```rust
1616
/// # extern crate rocket;

contrib/lib/src/templates/mod.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,13 @@ const DEFAULT_TEMPLATE_DIR: &str = "templates";
6969
/// Template discovery is actualized by the template fairing, which itself is
7070
/// created via the [`Template::fairing()`] or [`Template::custom()`] method. In
7171
/// order for _any_ templates to be rendered, the template fairing _must_ be
72-
/// [attached](/rocket/struct.Rocket.html#method.attach) to the running Rocket
73-
/// instance. Failure to do so will result in an error.
72+
/// [attached](rocket::Rocket::attach()) to the running Rocket instance. Failure
73+
/// to do so will result in an error.
7474
///
7575
/// Templates are rendered with the `render` method. The method takes in the
7676
/// name of a template and a context to render the template with. The context
77-
/// can be any type that implements `Serialize` from
78-
/// [Serde](https://github.com/serde-rs/json) and would serialize to an `Object`
79-
/// value.
77+
/// can be any type that implements [`Serialize`] from [`serde`] and would
78+
/// serialize to an `Object` value.
8079
///
8180
/// In debug mode (without the `--release` flag passed to `cargo`), templates
8281
/// will be automatically reloaded from disk if any changes have been made to
@@ -89,15 +88,15 @@ const DEFAULT_TEMPLATE_DIR: &str = "templates";
8988
/// feature, or both, to the `rocket_contrib` dependencies section of your
9089
/// `Cargo.toml`:
9190
///
92-
/// ```toml,ignore
91+
/// ```toml
9392
/// [dependencies.rocket_contrib]
9493
/// version = "*"
9594
/// default-features = false
9695
/// features = ["handlebars_templates", "tera_templates"]
9796
/// ```
9897
///
99-
/// Then, ensure that the template [fairing](/rocket/fairing/) is attached to
100-
/// your Rocket application:
98+
/// Then, ensure that the template [`Fairing`] is attached to your Rocket
99+
/// application:
101100
///
102101
/// ```rust
103102
/// extern crate rocket;
@@ -114,7 +113,7 @@ const DEFAULT_TEMPLATE_DIR: &str = "templates";
114113
/// }
115114
/// ```
116115
///
117-
/// The `Template` type implements Rocket's `Responder` trait, so it can be
116+
/// The `Template` type implements Rocket's [`Responder`] trait, so it can be
118117
/// returned from a request handler directly:
119118
///
120119
/// ```rust,ignore
@@ -130,9 +129,6 @@ const DEFAULT_TEMPLATE_DIR: &str = "templates";
130129
/// You can use the [`Template::custom()`] method to construct a fairing with
131130
/// customized templating engines. Among other things, this method allows you to
132131
/// register template helpers and register templates from strings.
133-
///
134-
/// [`Template::custom()`]: /rocket_contrib/struct.Template.html#method.custom
135-
/// [`Template::fairing()`]: /rocket_contrib/struct.Template.html#method.fairing
136132
#[derive(Debug)]
137133
pub struct Template {
138134
name: Cow<'static, str>,
@@ -161,8 +157,6 @@ impl Template {
161157
/// If you wish to customize the internal templating engines, use
162158
/// [`Template::custom()`] instead.
163159
///
164-
/// [`Template::custom()`]: /rocket_contrib/struct.Template.html#method.custom
165-
///
166160
/// # Example
167161
///
168162
/// To attach this fairing, simple call `attach` on the application's
@@ -192,8 +186,6 @@ impl Template {
192186
/// templating engines via the parameter `f`. Note that only the enabled
193187
/// templating engines will be accessible from the `Engines` type.
194188
///
195-
/// [`Template::fairing()`]: /rocket_contrib/struct.Template.html#method.fairing
196-
///
197189
/// # Example
198190
///
199191
/// ```rust

contrib/lib/src/uuid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use rocket::http::RawStr;
99

1010
pub use self::uuid_ext::parser::ParseError as UuidParseError;
1111

12-
/// Implements `FromParam` and `FormFormValue` for accepting UUID values from
13-
/// the [uuid](https://github.com/rust-lang-nursery/uuid) crate.
12+
/// Implements [`FromParam`] and [`FromFormValue`] for accepting UUID values
13+
/// from the [`uuid`] crate.
1414
///
1515
/// # Usage
1616
///

core/codegen_next/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@
149149
//! field name is expected. In this case, the `field` name in the attribute is
150150
//! used instead of the structure's actual field name when parsing a form.
151151
//!
152-
//! [`FromForm`]: /rocket/request/trait.FromForm.html
153-
//! [`FromFormValue`]: /rocket/request/trait.FromFormValue.html
152+
//! [`FromForm`]: rocket::request::FromForm
153+
//! [`FromFormValue`]: rocket::request::FromFormValue
154154
//!
155155
//! ### `FromFormValue`
156156
//!
@@ -306,9 +306,9 @@
306306
//! The [`Response`] produced from the generated implementation will have its
307307
//! content-type overriden to this value.
308308
//!
309-
//! [`Responder`]: /rocket/response/trait.Responder.html
310-
//! [`Response`]: /rocket/struct.Response.html
311-
//! [`Response::set_header()`]: /rocket/struct.Response.html#method.set_header
309+
//! [`Responder`]: rocket::response::Responder
310+
//! [`Response`]: rocket::Response
311+
//! [`Response::set_header()`]: rocket::Response::set_header()
312312
//!
313313
//! ## Procedural Macros
314314
//!
@@ -404,9 +404,9 @@
404404
//! If a mount-point is provided, the mount-point is prepended to the route's
405405
//! URI.
406406
//!
407-
//! [`Uri`]: /rocket/http/uri/struct.URI.html
408-
//! [`FromUriParam`]: /rocket/http/uri/trait.FromUriParam.html
409-
//! [`UriDisplay`]: /rocket/http/uri/trait.UriDisplay.html
407+
//! [`Uri`]: http::uri::URI
408+
//! [`FromUriParam`]: http::uri::FromUriParam
409+
//! [`UriDisplay`]: http::uri::UriDisplay
410410
//!
411411
//! # Debugging Codegen
412412
//!

0 commit comments

Comments
 (0)