Skip to content

Commit 21f7ffc

Browse files
committed
feat: move trailers to the transfer module
based on http-rs#309 by @brightly-salty
2 parents 13bec83 + dca360e commit 21f7ffc

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,19 @@ pub use status::Status;
151151
pub use status_code::StatusCode;
152152
pub use version::Version;
153153

154+
#[doc(inline)]
155+
pub use transfer::trailers::Trailers;
156+
157+
#[doc(inline)]
158+
pub use mime::Mime;
159+
160+
#[doc(inline)]
161+
pub use headers::Headers;
162+
154163
#[doc(inline)]
155164
pub use crate::url::Url;
156165

157166
pub mod security;
158-
pub mod trailers;
159167

160168
#[cfg(feature = "hyperium_http")]
161169
mod hyperium_http;

src/request.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use std::task::{Context, Poll};
1010
use crate::convert::{DeserializeOwned, Serialize};
1111
use crate::headers::{self, HeaderName, HeaderValue, HeaderValues, Headers, Names, ToHeaderValues, Values, CONTENT_TYPE};
1212
use crate::mime::Mime;
13-
use crate::trailers::{self, Trailers};
13+
14+
use crate::transfer::{trailers, Trailers};
1415
use crate::{Body, Extensions, Method, Url, Version};
1516

1617
pin_project_lite::pin_project! {
@@ -532,7 +533,7 @@ impl Request {
532533
self.version = version;
533534
}
534535

535-
/// Sends trailers to the a receiver.
536+
/// Sends trailers to the receiver.
536537
pub fn send_trailers(&mut self) -> trailers::Sender {
537538
self.has_trailers = true;
538539
let sender = self.trailers_sender.take().expect("Trailers sender can only be constructed once");

src/response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::task::{Context, Poll};
1111
use crate::convert::DeserializeOwned;
1212
use crate::headers::{self, HeaderName, HeaderValue, HeaderValues, Headers, Names, ToHeaderValues, Values, CONTENT_TYPE};
1313
use crate::mime::Mime;
14-
use crate::trailers::{self, Trailers};
14+
use crate::transfer::{trailers, Trailers};
1515
use crate::upgrade;
1616
use crate::{Body, Extensions, StatusCode, Version};
1717

src/transfer/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
mod encoding;
66
mod encoding_proposal;
77
mod te;
8+
pub mod trailers;
89
mod transfer_encoding;
910

1011
pub use encoding::Encoding;
1112
pub use encoding_proposal::EncodingProposal;
1213
pub use te::TE;
14+
pub use trailers::Trailers;
1315
pub use transfer_encoding::TransferEncoding;

src/trailers.rs src/transfer/trailers.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//! # async_std::task::block_on(async {
2424
//! #
2525
//! use http_types_rs::{Url, Method, Request};
26-
//! use http_types_rs::trailers::Trailers;
26+
//! use http_types_rs::transfer::Trailers;
2727
//! use http_types_rs::headers::{HeaderName, HeaderValue};
2828
//! use async_std::task;
2929
//! use std::str::FromStr;
@@ -76,7 +76,7 @@ impl Trailers {
7676
/// ```
7777
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
7878
/// #
79-
/// use http_types_rs::trailers::Trailers;
79+
/// use http_types_rs::transfer::Trailers;
8080
///
8181
/// let mut trailers = Trailers::new();
8282
/// trailers.insert("Content-Type", "text/plain");
@@ -97,7 +97,7 @@ impl Trailers {
9797
/// ```
9898
/// # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
9999
/// #
100-
/// use http_types_rs::trailers::Trailers;
100+
/// use http_types_rs::transfer::Trailers;
101101
///
102102
/// let mut trailers = Trailers::new();
103103
/// trailers.append("Content-Type", "text/plain");

0 commit comments

Comments
 (0)