| @@ -6,14 +6,15 @@ use url::Url; | |||||||
| use method::{mod, Get, Post, Delete, Put, Patch, Head, Options}; | use method::{mod, Get, Post, Delete, Put, Patch, Head, Options}; | ||||||
| use header::Headers; | use header::Headers; | ||||||
| use header::common::{mod, Host}; | use header::common::{mod, Host}; | ||||||
| use net::{NetworkStream, HttpStream, WriteStatus, Fresh, Streaming}; | use net::{NetworkStream, HttpStream, Fresh, Streaming}; | ||||||
| use http::{HttpWriter, ThroughWriter, ChunkedWriter, SizedWriter, LINE_ENDING}; | use http::{HttpWriter, ThroughWriter, ChunkedWriter, SizedWriter, LINE_ENDING}; | ||||||
| use version; | use version; | ||||||
| use {HttpResult, HttpUriError}; | use {HttpResult, HttpUriError}; | ||||||
| use client::Response; | use client::Response; | ||||||
|  |  | ||||||
|  |  | ||||||
| /// A client request to a remote server. | /// A client request to a remote server. | ||||||
| pub struct Request<W: WriteStatus> { | pub struct Request<W> { | ||||||
|     /// The target URI for this request. |     /// The target URI for this request. | ||||||
|     pub url: Url, |     pub url: Url, | ||||||
|  |  | ||||||
| @@ -25,7 +26,7 @@ pub struct Request<W: WriteStatus> { | |||||||
|     method: method::Method, |     method: method::Method, | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<W: WriteStatus> Request<W> { | impl<W> Request<W> { | ||||||
|     /// Read the Request headers. |     /// Read the Request headers. | ||||||
|     #[inline] |     #[inline] | ||||||
|     pub fn headers(&self) -> &Headers { &self.headers } |     pub fn headers(&self) -> &Headers { &self.headers } | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								src/net.rs
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/net.rs
									
									
									
									
									
								
							| @@ -14,17 +14,6 @@ pub struct Fresh; | |||||||
| /// The write-status indicating headers have been written. | /// The write-status indicating headers have been written. | ||||||
| pub struct Streaming; | pub struct Streaming; | ||||||
|  |  | ||||||
| /// The write-status of a Request |  | ||||||
| pub trait WriteStatus: Private {} |  | ||||||
| impl WriteStatus for Fresh {} |  | ||||||
| impl WriteStatus for Streaming {} |  | ||||||
|  |  | ||||||
| // Only Fresh and Streaming can be WriteStatus |  | ||||||
| #[doc(hidden)] |  | ||||||
| trait Private {} |  | ||||||
| impl Private for Fresh {} |  | ||||||
| impl Private for Streaming {} |  | ||||||
|  |  | ||||||
| /// An abstraction to listen for connections on a certain port. | /// An abstraction to listen for connections on a certain port. | ||||||
| pub trait NetworkListener<S: NetworkStream, A: NetworkAcceptor<S>>: Listener<S, A> { | pub trait NetworkListener<S: NetworkStream, A: NetworkAcceptor<S>>: Listener<S, A> { | ||||||
|     /// Bind to a socket. |     /// Bind to a socket. | ||||||
|   | |||||||
| @@ -10,11 +10,12 @@ use header; | |||||||
| use header::common; | use header::common; | ||||||
| use http::{CR, LF, LINE_ENDING, HttpWriter, ThroughWriter, ChunkedWriter, SizedWriter}; | use http::{CR, LF, LINE_ENDING, HttpWriter, ThroughWriter, ChunkedWriter, SizedWriter}; | ||||||
| use status; | use status; | ||||||
| use net::{NetworkStream, WriteStatus, Fresh, Streaming}; | use net::{NetworkStream, Fresh, Streaming}; | ||||||
| use version; | use version; | ||||||
|  |  | ||||||
|  |  | ||||||
| /// The outgoing half for a Tcp connection, created by a `Server` and given to a `Handler`. | /// The outgoing half for a Tcp connection, created by a `Server` and given to a `Handler`. | ||||||
| pub struct Response<W: WriteStatus> { | pub struct Response<W> { | ||||||
|     /// The HTTP version of this response. |     /// The HTTP version of this response. | ||||||
|     pub version: version::HttpVersion, |     pub version: version::HttpVersion, | ||||||
|     // Stream the Response is writing to, not accessible through UnwrittenResponse |     // Stream the Response is writing to, not accessible through UnwrittenResponse | ||||||
| @@ -25,7 +26,7 @@ pub struct Response<W: WriteStatus> { | |||||||
|     headers: header::Headers |     headers: header::Headers | ||||||
| } | } | ||||||
|  |  | ||||||
| impl<W: WriteStatus> Response<W> { | impl<W> Response<W> { | ||||||
|     /// The status of this response. |     /// The status of this response. | ||||||
|     #[inline] |     #[inline] | ||||||
|     pub fn status(&self) -> status::StatusCode { self.status } |     pub fn status(&self) -> status::StatusCode { self.status } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user