From faa4ad980faf7a112281e3c49de5a8c4c9c03de5 Mon Sep 17 00:00:00 2001 From: Dmitry Pypin Date: Mon, 9 Sep 2019 17:50:14 -0700 Subject: [PATCH] Renamed Send->SendBody --- awc/src/request.rs | 72 +++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/awc/src/request.rs b/awc/src/request.rs index 81b97cc7e..4dd07c5d8 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -396,7 +396,7 @@ impl ClientRequest { pub fn send_body( self, body: B, - ) -> Send + ) -> SendBody where B: Into, { @@ -413,7 +413,7 @@ impl ClientRequest { pub fn send_json( self, value: &T, - ) -> Send + ) -> SendBody { let slf = match self.prep_for_sending() { Ok(slf) => slf, @@ -430,7 +430,7 @@ impl ClientRequest { pub fn send_form( self, value: &T, - ) -> Send + ) -> SendBody { let slf = match self.prep_for_sending() { Ok(slf) => slf, @@ -445,7 +445,7 @@ impl ClientRequest { pub fn send_stream( self, stream: S, - ) -> Send + ) -> SendBody where S: Stream + 'static, E: Into + 'static, @@ -462,7 +462,7 @@ impl ClientRequest { /// Set an empty body and generate `ClientRequest`. pub fn send( self, - ) -> Send + ) -> SendBody { let slf = match self.prep_for_sending() { Ok(slf) => slf, @@ -584,7 +584,7 @@ impl FrozenClientRequest { pub fn send_body( &self, body: B, - ) -> Send + ) -> SendBody where B: Into, { @@ -596,7 +596,7 @@ impl FrozenClientRequest { pub fn send_json( &self, value: &T, - ) -> Send + ) -> SendBody { RequestSender::Rc(self.head.clone(), None) .send_json(self.addr, self.response_decompress, self.timeout, self.config.as_ref(), value) @@ -606,7 +606,7 @@ impl FrozenClientRequest { pub fn send_form( &self, value: &T, - ) -> Send + ) -> SendBody { RequestSender::Rc(self.head.clone(), None) .send_form(self.addr, self.response_decompress, self.timeout, self.config.as_ref(), value) @@ -616,7 +616,7 @@ impl FrozenClientRequest { pub fn send_stream( &self, stream: S, - ) -> Send + ) -> SendBody where S: Stream + 'static, E: Into + 'static, @@ -628,7 +628,7 @@ impl FrozenClientRequest { /// Send an empty body. pub fn send( &self, - ) -> Send + ) -> SendBody { RequestSender::Rc(self.head.clone(), None) .send(self.addr, self.response_decompress, self.timeout, self.config.as_ref()) @@ -684,7 +684,7 @@ impl FrozenSendBuilder { pub fn send_body( self, body: B, - ) -> Send + ) -> SendBody where B: Into, { @@ -700,7 +700,7 @@ impl FrozenSendBuilder { pub fn send_json( self, value: &T, - ) -> Send + ) -> SendBody { if let Some(e) = self.err { return e.into() @@ -714,7 +714,7 @@ impl FrozenSendBuilder { pub fn send_form( self, value: &T, - ) -> Send + ) -> SendBody { if let Some(e) = self.err { return e.into() @@ -728,7 +728,7 @@ impl FrozenSendBuilder { pub fn send_stream( self, stream: S, - ) -> Send + ) -> SendBody where S: Stream + 'static, E: Into + 'static, @@ -744,7 +744,7 @@ impl FrozenSendBuilder { /// Complete request construction and send an empty body. pub fn send( self, - ) -> Send + ) -> SendBody { if let Some(e) = self.err { return e.into() @@ -779,33 +779,33 @@ impl Into for PrepForSendingError { } } -pub enum Send +pub enum SendBody { Fut(Box>, Option, bool), Err(Option), } -impl Send +impl SendBody { pub fn new( send: Box>, response_decompress: bool, timeout: Option, - ) -> Send + ) -> SendBody { let delay = timeout.map(|t| Delay::new(Instant::now() + t)); - Send::Fut(send, delay, response_decompress) + SendBody::Fut(send, delay, response_decompress) } } -impl Future for Send +impl Future for SendBody { type Item = ClientResponse>>; type Error = SendRequestError; fn poll(&mut self) -> Poll { match self { - Send::Fut(send, delay, response_decompress) => { + SendBody::Fut(send, delay, response_decompress) => { if delay.is_some() { match delay.poll() { Ok(Async::NotReady) => (), @@ -824,7 +824,7 @@ impl Future for Send Ok(Async::Ready(res)) }, - Send::Err(ref mut e) => { + SendBody::Err(ref mut e) => { match e.take() { Some(e) => Err(e.into()), None => panic!("Attempting to call completed future"), @@ -835,31 +835,31 @@ impl Future for Send } -impl From for Send +impl From for SendBody { fn from(e: SendRequestError) -> Self { - Send::Err(Some(e)) + SendBody::Err(Some(e)) } } -impl From for Send +impl From for SendBody { fn from(e: Error) -> Self { - Send::Err(Some(e.into())) + SendBody::Err(Some(e.into())) } } -impl From for Send +impl From for SendBody { fn from(e: HttpError) -> Self { - Send::Err(Some(e.into())) + SendBody::Err(Some(e.into())) } } -impl From for Send +impl From for SendBody { fn from(e: PrepForSendingError) -> Self { - Send::Err(Some(e.into())) + SendBody::Err(Some(e.into())) } } @@ -877,7 +877,7 @@ impl RequestSender { timeout: Option, config: &ClientConfig, body: B, - ) -> Send + ) -> SendBody where B: Into, { @@ -888,7 +888,7 @@ impl RequestSender { RequestSender::Rc(head, extra_headers) => connector.send_request_extra(head, extra_headers, body.into(), addr), }; - Send::new(fut, response_decompress, timeout.or_else(|| config.timeout.clone())) + SendBody::new(fut, response_decompress, timeout.or_else(|| config.timeout.clone())) } pub fn send_json( @@ -898,7 +898,7 @@ impl RequestSender { timeout: Option, config: &ClientConfig, value: &T, - ) -> Send + ) -> SendBody { let body = match serde_json::to_string(value) { Ok(body) => body, @@ -919,7 +919,7 @@ impl RequestSender { timeout: Option, config: &ClientConfig, value: &T, - ) -> Send + ) -> SendBody { let body = match serde_urlencoded::to_string(value) { Ok(body) => body, @@ -941,7 +941,7 @@ impl RequestSender { timeout: Option, config: &ClientConfig, stream: S, - ) -> Send + ) -> SendBody where S: Stream + 'static, E: Into + 'static, @@ -955,7 +955,7 @@ impl RequestSender { response_decompress: bool, timeout: Option, config: &ClientConfig, - ) -> Send + ) -> SendBody { self.send_body(addr, response_decompress, timeout, config, Body::Empty) }