Skip to content

Commit 86eddf6

Browse files
lawliet89V1oL3nc
authored and
V1oL3nc
committed
Use intra rustdoc links
See rust-lang/rust#43466
1 parent a4d16ac commit 86eddf6

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/lib.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
//! stable. See
2020
//! [installation instructions](https://rocket.rs/guide/getting-started/#installing-rust).
2121
//!
22-
//! In particular, `rocket_cors` is currently targetted for `nightly-2017-07-21`. Newer nightlies
23-
//! might work, but it's not guaranteed.
22+
//! In particular, `rocket_cors` is currently targetted for the latest `nightly`. Older nightlies
23+
//! might work, but they are subject to the minimum that Rocket sets.
2424
//!
2525
//! ## Installation
2626
//!
@@ -59,9 +59,9 @@
5959
//!
6060
//! ### `Cors` Struct
6161
//!
62-
//! The [`Cors` struct](struct.Cors.html) contains the settings for CORS requests to be validated
62+
//! The [`Cors` struct](Cors) contains the settings for CORS requests to be validated
6363
//! and for responses to be generated. Defaults are defined for every field in the struct, and
64-
//! are documented on the [`Cors` struct](struct.Cors.html) page. You can also deserialize
64+
//! are documented on the [`Cors` struct](Cors) page. You can also deserialize
6565
//! the struct from some format like JSON, YAML or TOML when the default `serialization` feature
6666
//! is enabled.
6767
//!
@@ -97,7 +97,7 @@
9797
//! However, you can only have one set of settings that must apply to all routes. You cannot opt
9898
//! any route out of CORS checks.
9999
//!
100-
//! To use this, simply create a [`Cors` struct](struct.Cors.html) and then
100+
//! To use this, simply create a [`Cors` struct](Cors) and then
101101
//! [`attach`](https://api.rocket.rs/rocket/struct.Rocket.html#method.attach) it to Rocket.
102102
//!
103103
//! ```rust,no_run
@@ -144,18 +144,18 @@
144144
//!
145145
//! You will have to do the following:
146146
//!
147-
//! - Create a [`Cors` struct](struct.Cors.html) and during Rocket's ignite, add the struct to
147+
//! - Create a [`Cors` struct](Cors) and during Rocket's ignite, add the struct to
148148
//! Rocket's [managed state](https://rocket.rs/guide/state/#managed-state).
149149
//! - For all the routes that you want to enforce CORS on, you can mount either some
150-
//! [catch all route](fn.catch_all_options_routes.html) or define your own route for the OPTIONS
150+
//! [catch all route](catch_all_options_routes) or define your own route for the OPTIONS
151151
//! verb.
152152
//! - Then in all the routes you want to enforce CORS on, add a
153153
//! [Request Guard](https://rocket.rs/guide/requests/#request-guards) for the
154-
//! [`Guard`](struct.Guard.html) struct in the route arguments. You should not wrap this in an
154+
//! [`Guard`](Guard) struct in the route arguments. You should not wrap this in an
155155
//! `Option` or `Result` because the guard will let non-CORS requests through and will take over
156156
//! error handling in case of errors.
157157
//! - In your routes, to add CORS headers to your responses, use the appropriate functions on the
158-
//! [`Guard`](struct.Guard.html) for a `Response` or a `Responder`.
158+
//! [`Guard`](Guard) for a `Response` or a `Responder`.
159159
//!
160160
//! ```rust,no_run
161161
//! #![feature(plugin)]
@@ -252,10 +252,10 @@
252252
//! Alternatively, you can create a `Cors` struct directly in the route.
253253
//! - Your routes _might_ need to have a `'r` lifetime and return `impl Responder<'r>`. See below.
254254
//! - Using the `Cors` struct, use either the
255-
//! [`respond_owned`](struct.Cors.html#method.respond_owned) or
256-
//! [`respond_borrowed`](struct.Cors.html#method.respond_borrowed) function and pass in a handler
255+
//! [`respond_owned`](Cors#method.respond_owned) or
256+
//! [`respond_borrowed`](Cors#method.respond_borrowed) function and pass in a handler
257257
//! that will be executed once CORS validation is successful.
258-
//! - Your handler will be passed a [`Guard`](struct.Guard.html) which you will have to use to
258+
//! - Your handler will be passed a [`Guard`](Guard) which you will have to use to
259259
//! add CORS headers into your own response.
260260
//! - You will have to manually define your own `OPTIONS` routes.
261261
//!
@@ -352,15 +352,15 @@
352352
//!
353353
//! /// Using a borrowed Cors
354354
//! #[get("/")]
355-
//! fn borrowed<'r>(options: State<'r, Cors>) -> impl Responder<'r> {
355+
//! fn borrowed(options: State<Cors>) -> impl Responder {
356356
//! options.inner().respond_borrowed(
357357
//! |guard| guard.responder("Hello CORS"),
358358
//! )
359359
//! }
360360
//!
361361
//! /// Using a `Response` instead of a `Responder`. You generally won't have to do this.
362362
//! #[get("/response")]
363-
//! fn response<'r>(options: State<'r, Cors>) -> impl Responder<'r> {
363+
//! fn response(options: State<Cors>) -> impl Responder {
364364
//! let mut response = Response::new();
365365
//! response.set_sized_body(Cursor::new("Hello CORS!"));
366366
//!
@@ -455,8 +455,8 @@
455455
//!
456456
//! /// A special struct that allows all origins
457457
//! ///
458-
//! /// Note: In your real application, you might want to use something like `lazy_static` to generate
459-
//! /// a `&'static` reference to this instead of creating a new struct on every request.
458+
//! /// Note: In your real application, you might want to use something like `lazy_static` to
459+
//! /// generate a `&'static` reference to this instead of creating a new struct on every request.
460460
//! fn cors_options_all() -> Cors {
461461
//! // You can also deserialize this
462462
//! rocket_cors::Cors {

0 commit comments

Comments
 (0)