From 2d56af504dbca317dedfc753148f8a4a0e11b6b3 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 15 Oct 2018 23:24:23 -0700 Subject: [PATCH] Fix broken site URLs and typos. --- site/guide/4-requests.md | 2 +- site/guide/5-responses.md | 10 ++++----- site/guide/6-state.md | 14 +++++++----- site/guide/7-fairings.md | 2 +- site/guide/8-testing.md | 2 +- site/guide/9-configuration.md | 6 ++--- site/news/2017-02-06-version-0.2.md | 2 +- site/news/2017-07-14-version-0.3.md | 10 ++++----- site/overview.toml | 35 +++++++++++++---------------- 9 files changed, 41 insertions(+), 42 deletions(-) diff --git a/site/guide/4-requests.md b/site/guide/4-requests.md index cf78cbd3..a69de539 100644 --- a/site/guide/4-requests.md +++ b/site/guide/4-requests.md @@ -636,7 +636,7 @@ examples on GitHub provide further illustrations. ### JSON Handling JSON data is no harder: simply use the -[`Json`](@api/rocket_contrib/struct.Json.html) type: +[`Json`](@api/rocket_contrib/json/struct.Json.html) type: ```rust #[derive(Deserialize)] diff --git a/site/guide/5-responses.md b/site/guide/5-responses.md index e2725e42..d0c19161 100644 --- a/site/guide/5-responses.md +++ b/site/guide/5-responses.md @@ -208,7 +208,7 @@ fn stream() -> io::Result> { ### JSON -The [`JSON`] responder in [`rocket_contrib`] allows you to easily respond with +The [`Json`] responder in [`rocket_contrib`] allows you to easily respond with well-formed JSON data: simply return a value of type `Json` where `T` is the type of a structure to serialize into JSON. The type `T` must implement the [`Serialize`] trait from [`serde`], which can be automatically derived. @@ -217,7 +217,7 @@ As an example, to respond with the JSON value of a `Task` structure, we might write: ```rust -use rocket_contrib::Json; +use rocket_contrib::json::Json; #[derive(Serialize)] struct Task { ... } @@ -226,13 +226,13 @@ struct Task { ... } fn todo() -> Json { ... } ``` -The `JSON` type serializes the structure into JSON, sets the Content-Type to +The `Json` type serializes the structure into JSON, sets the Content-Type to JSON, and emits the serialized data in a fixed-sized body. If serialization fails, a **500 - Internal Server Error** is returned. The [JSON example on GitHub] provides further illustration. -[`JSON`]: @api/rocket_contrib/struct.Json.html +[`Json`]: @api/rocket_contrib/json/struct.Json.html [`Serialize`]: https://docs.serde.rs/serde/trait.Serialize.html [`serde`]: https://docs.serde.rs/serde/ [JSON example on GitHub]: @example/json @@ -285,5 +285,5 @@ including how to customize a template engine to add custom helpers and filters. The [Handlebars Templates example on GitHub](@example/handlebars_templates) is a fully composed application that makes use of Handlebars templates. -[`Template`]: @api/rocket_contrib/struct.Template.html +[`Template`]: @api/rocket_contrib/templates/struct.Template.html [configurable]: ../configuration/#extras diff --git a/site/guide/6-state.md b/site/guide/6-state.md index 662d8016..564667af 100644 --- a/site/guide/6-state.md +++ b/site/guide/6-state.md @@ -135,12 +135,12 @@ Note that, without request-local state, it would not be possible to: 1. Associate a piece of data, here an ID, directly with a request. 2. Ensure that a value is generated at most once per request. -For more examples, see the [`FromRequest`] documentation, which uses -request-local state to cache expensive authentication and authorization -computations, and the [`Fairing`] documentation, which uses request-local state -to implement request timing. +For more examples, see the [`FromRequest` request-local state] documentation, +which uses request-local state to cache expensive authentication and +authorization computations, and the [`Fairing`] documentation, which uses +request-local state to implement request timing. -[`FromRequest`]: @api/rocket/request/trait.FromRequest.htmll#request-local-state +[`FromRequest` request-local state]: @api/rocket/request/trait.FromRequest.html#request-local-state [`Fairing`]: @api/rocket/fairing/trait.Fairing.html#request-local-state ## Databases @@ -222,7 +222,9 @@ Finally, attach the fairing returned by `YourType::fairing()`, which was generated by the `#[database]` attribute: ```rust -use rocket_contrib::databases::{database, diesel}; +#[macro_use] extern crate rocket_contrib; + +use rocket_contrib::databases::diesel; #[database("sqlite_logs")] struct LogsDbConn(diesel::SqliteConnection); diff --git a/site/guide/7-fairings.md b/site/guide/7-fairings.md index 1879be9e..c433f84f 100644 --- a/site/guide/7-fairings.md +++ b/site/guide/7-fairings.md @@ -210,4 +210,4 @@ rocket::ignite() })); ``` -[`AdHoc`]: @api/rocket/fairing/enum.AdHoc.html +[`AdHoc`]: @api/rocket/fairing/struct.AdHoc.html diff --git a/site/guide/8-testing.md b/site/guide/8-testing.md index 1d7c1ac7..9a0c33e0 100644 --- a/site/guide/8-testing.md +++ b/site/guide/8-testing.md @@ -36,7 +36,7 @@ instance. Usage is straightforward: let response = req.dispatch(); ``` -[`local`]: @api/rocket/local/index.html +[`local`]: @api/rocket/local/ [`Client`]: @api/rocket/local/struct.Client.html [`LocalRequest`]: @api/rocket/local/struct.LocalRequest.html [`Rocket`]: @api/rocket/struct.Rocket.html diff --git a/site/guide/9-configuration.md b/site/guide/9-configuration.md index 13d4ff80..1f1147d3 100644 --- a/site/guide/9-configuration.md +++ b/site/guide/9-configuration.md @@ -132,7 +132,7 @@ data limits as well. Data limits can be retrieved at runtime via the [`Request::limits()`] method. [`Request::limits()`]: @api/rocket/struct.Request.html#method.limits -[`Json`]: @api/rocket_contrib/struct.Json.html#incoming-data-limits +[`Json`]: @api/rocket_contrib/json/struct.Json.html#incoming-data-limits ## Extras @@ -140,7 +140,7 @@ In addition to overriding default configuration parameters, a configuration file can also define values for any number of _extra_ configuration parameters. While these parameters aren't used by Rocket directly, other libraries, or your own application, can use them as they wish. As an example, the -[Template](@api/rocket_contrib/struct.Template.html) type +[Template](@api/rocket_contrib/templates/struct.Template.html) type accepts a value for the `template_dir` configuration parameter. The parameter can be set in `Rocket.toml` as follows: @@ -237,7 +237,7 @@ ROCKET_ARRAY=[1,"b",3.14] ROCKET_DICT={key="abc",val=123} ``` -## Custom Programmatic Configuration +## Programmatic In addition to using environment variables or a config file, Rocket can also be configured using the [`rocket::custom()`] method and [`ConfigBuilder`]: diff --git a/site/news/2017-02-06-version-0.2.md b/site/news/2017-02-06-version-0.2.md index 31aa3b6a..c1cd824f 100644 --- a/site/news/2017-02-06-version-0.2.md +++ b/site/news/2017-02-06-version-0.2.md @@ -174,7 +174,7 @@ Configuration parameters set via environment variables take precedence over parameters set via the `Rocket.toml` configuration file. Note that _any_ parameter can be set via an environment variable, include _extras_. For more about configuration in Rocket, see the [configuration section of the -guide](../../guide/overview/#configuration). +guide](../../guide/overview#configuration). ### And Plenty More! diff --git a/site/news/2017-07-14-version-0.3.md b/site/news/2017-07-14-version-0.3.md index f89ce8b2..be77a938 100644 --- a/site/news/2017-07-14-version-0.3.md +++ b/site/news/2017-07-14-version-0.3.md @@ -62,7 +62,7 @@ to experiment with fairings and report your experiences. As always, feedback is instrumental in solidifying a robust design. [`Fairing`]: @api/rocket/fairing/trait.Fairing.html -[fairings guide]: /guide/fairings +[fairings guide]: ../../guide/fairings ### Native TLS Support @@ -88,7 +88,7 @@ For more details on Rocket's TLS support, see the [configuring TLS] section of the guide. [`rustls`]: https://github.com/ctz/rustls -[configuring TLS]: /guide/configuration/#configuring-tls +[configuring TLS]: ../../guide/configuration/#configuring-tls ### Private Cookies @@ -130,7 +130,7 @@ guide. [`get_private`]: @api/rocket/http/enum.Cookies.html#method.get_private [`add_private`]: @api/rocket/http/enum.Cookies.html#method.add_private [`remove_private`]: @api/rocket/http/enum.Cookies.html#method.remove_private -[private cookies]: /guide/requests/#private-cookies +[private cookies]: ../../guide/requests/#private-cookies ### Form Field Naming @@ -211,7 +211,7 @@ following new features: * The [`NotFound`] responder was added for simple **404** response construction. -[`MsgPack`]: @api/rocket_contrib/struct.MsgPack.html +[`MsgPack`]: @api/rocket_contrib/msgpack/struct.MsgPack.html [`Rocket::launch()`]: @api/rocket/struct.Rocket.html#method.launch [`LaunchError`]: @api/rocket/error/struct.LaunchError.html [Default rankings]: @api/rocket/struct.Route.html @@ -300,7 +300,7 @@ and usability. The following major features are planned: type-checks. In the next release, a `url!` macro will be available to automatically generate URLs for routes in a type-safe manner. -[much wordier than necessary]: /guide/state/#databases +[much wordier than necessary]: ../../guide/state/#databases ## Contributors to v0.3 diff --git a/site/overview.toml b/site/overview.toml index a0b8fcb0..e777f098 100644 --- a/site/overview.toml +++ b/site/overview.toml @@ -55,10 +55,10 @@ which you can implement for your own types! name = "Handling Data" content = ''' Request body data is handled in a special way in Rocket: via the -[FromData](@api/rocket/data/trait.FromData.html) trait. Any -type that implements `FromData` can be derived from incoming body data. To tell -Rocket that you're expecting request body data, the `data` route argument is -used with the name of the parameter in the request handler: +[FromData](@api/rocket/data/trait.FromData.html) trait. Any type that implements +`FromData` can be derived from incoming body data. To tell Rocket that you're +expecting request body data, the `data` route argument is used with the name of +the parameter in the request handler: ```rust #[post("/login", data = "")] @@ -68,14 +68,13 @@ fn login(user_form: Form) -> String { ``` The `login` route above says that it expects `data` of type `Form` in -the `user_form` parameter. The -[Form](@api/rocket/request/struct.Form.html) type is a built-in -Rocket type that knows how to parse web forms into structures. Rocket will -automatically attempt to parse the request body into the `Form` and call the -`login` handler if parsing succeeds. Other built-in `FromData` types include -[`Data`](@api/rocket/struct.Data.html), -[`Json`](@api/rocket_contrib/struct.Json.html), and -[`Flash`](@api/rocket/response/struct.Flash.html) +the `user_form` parameter. The [Form](@api/rocket/request/struct.Form.html) type +is a built-in Rocket type that knows how to parse web forms into structures. +Rocket will automatically attempt to parse the request body into the `Form` and +call the `login` handler if parsing succeeds. Other built-in `FromData` types +include [`Data`](@api/rocket/struct.Data.html), +[`Json`](@api/rocket_contrib/json/struct.Json.html), and +[`Flash`](@api/rocket/response/struct.Flash.html). ''' [[panels]] @@ -98,8 +97,7 @@ fn sensitive(key: ApiKey) -> &'static str { ... } `ApiKey` protects the `sensitive` handler from running incorrectly. In order for Rocket to call the `sensitive` handler, the `ApiKey` type needs to be derived -through a -[FromRequest](@api/rocket/request/trait.FromRequest.html) +through a [FromRequest](@api/rocket/request/trait.FromRequest.html) implementation, which in this case, validates the API key header. Request guards are a powerful and unique Rocket concept; they centralize application policy and invariants through types. @@ -121,13 +119,12 @@ the standard library types including `&str`, `String`, `File`, `Option`, and `Result`. Rocket also implements custom responders such as [Redirect](@api/rocket/response/struct.Redirect.html), [Flash](@api/rocket/response/struct.Flash.html), and -[Template](@api/rocket_contrib/struct.Template.html). +[Template](@api/rocket_contrib/templates/struct.Template.html). The task of a `Responder` is to generate a -[`Response`](@api/rocket/response/struct.Response.html), if -possible. `Responder`s can fail with a status code. When they do, Rocket calls -the corresponding error catcher, a `catch` route, which can be declared as -follows: +[`Response`](@api/rocket/response/struct.Response.html), if possible. +`Responder`s can fail with a status code. When they do, Rocket calls the +corresponding error catcher, a `catch` route, which can be declared as follows: ```rust #[catch(404)]