diff options
author | softprops <d.tangren@gmail.com> | 2016-01-03 02:15:15 -0500 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2016-01-03 02:15:15 -0500 |
commit | fc7021901fd8d234fdf2ce51f1949a7230c10080 (patch) | |
tree | 0d18de872171e7bc2edc57395cfe4c53d4e9a421 /src/transport.rs | |
parent | 97e8fd471355c4ed5230119b54210a4727cfc861 (diff) |
back to shorter name
Diffstat (limited to 'src/transport.rs')
-rw-r--r-- | src/transport.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/transport.rs b/src/transport.rs index 8c76e88..a2c8d72 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -29,25 +29,25 @@ fn lift_status_err(status: u16) -> Result<Box<Read>> { } } -pub enum Transporter { +pub enum Transport { Tcp { client: Client, host: String }, Unix { client: Client, path: String } } -impl fmt::Debug for Transporter { +impl fmt::Debug for Transport { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { - Transporter::Tcp { ref host, .. } => { + Transport::Tcp { ref host, .. } => { write!(f, "Tcp({})", host) }, - Transporter::Unix { ref path, .. } => { + Transport::Unix { ref path, .. } => { write!(f, "Unix({})", path) } } } } -impl Transporter { +impl Transport { pub fn request(&mut self, method: Method, endpoint: &str, body: Option<Body>) -> Result<String> { let mut res = match self.stream(method, endpoint, body) { Ok(r) => r, @@ -60,10 +60,10 @@ impl Transporter { pub fn stream(&mut self, method: Method, endpoint: &str, body: Option<Body>) -> Result<Box<Read>> { println!("requesting {:?} {:?}", self, endpoint); let req = match *self { - Transporter::Tcp { ref client, ref host } => { + Transport::Tcp { ref client, ref host } => { client.request(method, &format!("{}{}", host, endpoint)[..]) }, - Transporter::Unix { ref client, ref path } => { + Transport::Unix { ref client, ref path } => { client.request(method, DomainUrl::new(&path, endpoint)) } }; |