Skip to content

Commit dcebb68

Browse files
committed
cargo fmt
1 parent 975805f commit dcebb68

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

src/request.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::headers::{
99
self, HeaderName, HeaderValue, Headers, Names, ToHeaderValues, Values, CONTENT_TYPE,
1010
};
1111
use crate::mime::Mime;
12-
use crate::Cookie;
1312
use crate::trailers::{Trailers, TrailersSender};
13+
use crate::Cookie;
1414
use crate::{Body, Method, Url, Version};
1515

1616
pin_project_lite::pin_project! {
@@ -377,7 +377,10 @@ impl Request {
377377

378378
/// Sends trailers to the a receiver.
379379
pub fn send_trailers(&mut self) -> TrailersSender {
380-
let sender = self.sender.take().expect("Trailers sender can only be constructed once");
380+
let sender = self
381+
.sender
382+
.take()
383+
.expect("Trailers sender can only be constructed once");
381384
TrailersSender::new(sender)
382385
}
383386

src/response.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,10 @@ impl Response {
330330

331331
/// Sends trailers to the a receiver.
332332
pub fn send_trailers(&mut self) -> TrailersSender {
333-
let sender = self.sender.take().expect("Trailers sender can only be constructed once");
333+
let sender = self
334+
.sender
335+
.take()
336+
.expect("Trailers sender can only be constructed once");
334337
TrailersSender::new(sender)
335338
}
336339

src/trailers.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
//! HTTP trailing headers.
2-
//!
2+
//!
33
//! Trailing headers are headers that are send *after* the body payload has
44
//! been sent. This is for example useful for sending integrity checks of
55
//! streamed payloads that are computed on the fly.
6-
//!
6+
//!
77
//! The way trailing headers are sent over the wire varies per protocol. But in
88
//! `http-types` we provide a `Trailers` struct that's used to contain the headers.
9-
//!
9+
//!
1010
//! To send trailing headers, see `Request::{`[`send_trailers, `][req_send]
1111
//! [`recv_trailers`][req_recv]`}` and
1212
//! `Response::{`[`send_trailers, `][res_send][`recv_trailers`][res_recv]`}`.
13-
//!
13+
//!
1414
//! [req_send]: ../struct.Request.html#method.send_trailers
1515
//! [req_recv]: ../struct.Request.html#method.recv_trailers
1616
//! [res_send]: ../struct.Response.html#method.send_trailers
1717
//! [res_recv]: ../struct.Response.html#method.recv_trailers
18-
//!
18+
//!
1919
//! ## Example
20-
//!
20+
//!
2121
//! ```
2222
//! # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
2323
//! # async_std::task::block_on(async {
@@ -28,31 +28,31 @@
2828
//! use std::str::FromStr;
2929
//!
3030
//! let mut req = Request::new(Method::Get, Url::parse("https://example.com").unwrap());
31-
//!
31+
//!
3232
//! let sender = req.send_trailers();
3333
//! let mut trailers = Trailers::new();
3434
//! trailers.insert(
3535
//! HeaderName::from_str("Content-Type")?,
3636
//! "text/plain",
3737
//! );
38-
//!
38+
//!
3939
//! task::spawn(async move {
4040
//! let _trailers = req.recv_trailers().await;
4141
//! });
42-
//!
42+
//!
4343
//! sender.send(Ok(trailers)).await;
4444
//! #
4545
//! # Ok(()) })}
4646
//! ```
47-
//!
47+
//!
4848
//! ## See Also
4949
//! - [MDN HTTP Headers: Trailer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer)
5050
//! - [HTTP/2 spec: HTTP Sequence](https://http2.github.io/http2-spec/#HttpSequence)
5151
52-
use async_std::sync::Sender;
5352
use crate::headers::{
5453
HeaderName, HeaderValue, Headers, Iter, IterMut, Names, ToHeaderValues, Values,
5554
};
55+
use async_std::sync::Sender;
5656

5757
use std::io;
5858
use std::ops::{Deref, DerefMut};
@@ -150,7 +150,7 @@ impl DerefMut for Trailers {
150150
}
151151

152152
/// The sending half of a channel to send trailers.
153-
///
153+
///
154154
/// Unlike `async_std::sync::channel` the `send` method on this type can only be
155155
/// called once, and cannot be cloned. That's because only a single instance of
156156
/// `Trailers` should be created.
@@ -166,7 +166,7 @@ impl TrailersSender {
166166
}
167167

168168
/// Send a `Trailer`.
169-
///
169+
///
170170
/// The channel will be consumed after having sent trailers.
171171
pub async fn send(self, trailers: io::Result<Trailers>) {
172172
self.sender.send(trailers).await

0 commit comments

Comments
 (0)