Skip to content

Commit ec95511

Browse files
lgmsantosseanmonstar
authored andcommitted
lib.rs intra-doc links
1 parent 3fe7267 commit ec95511

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/lib.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! A general purpose library of common HTTP types
22
//!
33
//! This crate is a general purpose library for common types found when working
4-
//! with the HTTP protocol. You'll find `Request` and `Response` types for
4+
//! with the HTTP protocol. You'll find [`Request`] and [`Response`] types for
55
//! working as either a client or a server as well as all of their components.
6-
//! Notably you'll find `Uri` for what a `Request` is requesting, a `Method`
7-
//! for how it's being requested, a `StatusCode` for what sort of response came
8-
//! back, a `Version` for how this was communicated, and
9-
//! `HeaderName`/`HeaderValue` definitions to get grouped in a `HeaderMap` to
6+
//! Notably you'll find `Uri` for what a [`Request`] is requesting, a [`Method`]
7+
//! for how it's being requested, a [`StatusCode`] for what sort of response came
8+
//! back, a [`Version`] for how this was communicated, and
9+
//! [`HeaderName`][header::HeaderName]/[`HeaderValue`][header::HeaderName] definitions to get grouped in a [`HeaderMap`] to
1010
//! work with request/response headers.
1111
//!
1212
//! You will notably *not* find an implementation of sending requests or
@@ -19,11 +19,11 @@
1919
//!
2020
//! ## Requests and Responses
2121
//!
22-
//! Perhaps the main two types in this crate are the `Request` and `Response`
23-
//! types. A `Request` could either be constructed to get sent off as a client
24-
//! or it can also be received to generate a `Response` for a server. Similarly
25-
//! as a client a `Response` is what you get after sending a `Request`, whereas
26-
//! on a server you'll be manufacturing a `Response` to send back to the client.
22+
//! Perhaps the main two types in this crate are the [`Request`] and [`Response`]
23+
//! types. A [`Request`] could either be constructed to get sent off as a client
24+
//! or it can also be received to generate a [`Response`] for a server. Similarly
25+
//! as a client a [`Response`] is what you get after sending a [`Request`], whereas
26+
//! on a server you'll be manufacturing a [`Response`] to send back to the client.
2727
//!
2828
//! Each type has a number of accessors for the component fields. For as a
2929
//! server you might want to inspect a requests URI to dispatch it:
@@ -45,8 +45,8 @@
4545
//! # fn not_found(_req: Request<()>) -> http::Result<Response<()>> { panic!() }
4646
//! ```
4747
//!
48-
//! On a `Request` you'll also find accessors like `method` to return a
49-
//! `Method` and `headers` to inspect the various headers. A `Response`
48+
//! On a [`Request`] you'll also find accessors like [`method`][Request::method] to return a
49+
//! [`Method`] and [`headers`][Request::method] to inspect the various headers. A [`Response`]
5050
//! has similar methods for headers, the status code, etc.
5151
//!
5252
//! In addition to getters, request/response types also have mutable accessors
@@ -64,7 +64,7 @@
6464
//! ```
6565
//!
6666
//! And finally, one of the most important aspects of requests/responses, the
67-
//! body! The `Request` and `Response` types in this crate are *generic* in
67+
//! body! The [`Request`] and [`Response`] types in this crate are *generic* in
6868
//! what their body is. This allows downstream libraries to use different
6969
//! representations such as `Request<Vec<u8>>`, `Response<impl Read>`,
7070
//! `Request<impl Stream<Item = Vec<u8>, Error = _>>`, or even
@@ -87,14 +87,14 @@
8787
//! Accept: text/html
8888
//! ```
8989
//!
90-
//! Then `"Accept"` is a `HeaderName` while `"text/html"` is a `HeaderValue`.
90+
//! Then `"Accept"` is a [`HeaderName`][header::HeaderName] while `"text/html"` is a [`HeaderValue`][header::HeaderValue].
9191
//! Each of these is a dedicated type to allow for a number of interesting
9292
//! optimizations and to also encode the static guarantees of each type. For
93-
//! example a `HeaderName` is always a valid `&str`, but a `HeaderValue` may
93+
//! example a [`HeaderName`][header::HeaderName] is always a valid `&str`, but a [`HeaderValue`] may
9494
//! not be valid UTF-8.
9595
//!
9696
//! The most common header names are already defined for you as constant values
97-
//! in the `header` module of this crate. For example:
97+
//! in the [`header`] module of this crate. For example:
9898
//!
9999
//! ```
100100
//! use http::header::{self, HeaderName};
@@ -112,7 +112,7 @@
112112
//! assert_eq!(name, header::ACCEPT);
113113
//! ```
114114
//!
115-
//! Header values can be created from string literals through the `from_static`
115+
//! Header values can be created from string literals through the [`from_static`][header::HeaderValue::from_static]
116116
//! function:
117117
//!
118118
//! ```
@@ -133,15 +133,15 @@
133133
//!
134134
//! Most HTTP requests and responses tend to come with more than one header, so
135135
//! it's not too useful to just work with names and values only! This crate also
136-
//! provides a `HeaderMap` type which is a specialized hash map for keys as
137-
//! `HeaderName` and generic values. This type, like header names, is optimized
136+
//! provides a [`HeaderMap`] type which is a specialized hash map for keys as
137+
//! [`HeaderName`][header::HeaderName] and generic values. This type, like header names, is optimized
138138
//! for common usage but should continue to scale with your needs over time.
139139
//!
140140
//! # URIs
141141
//!
142-
//! Each HTTP `Request` has an associated URI with it. This may just be a path
142+
//! Each HTTP [`Request`] has an associated URI with it. This may just be a path
143143
//! like `/index.html` but it could also be an absolute URL such as
144-
//! `https://www.rust-lang.org/index.html`. A `URI` has a number of accessors to
144+
//! `https://www.rust-lang.org/index.html`. A [`URI`][uri::Uri] has a number of accessors to
145145
//! interpret it:
146146
//!
147147
//! ```

0 commit comments

Comments
 (0)