These are chat archives for rust-lang/rust

15th
Jan 2015
mindcrime-ilab
@mindcrime-ilab
Jan 15 2015 22:09

Hi, could somebody explain what to do here?

trait HttpDelegate {
  fn doPost(url: &str, body: &str) ->HttpResult<Response>;
}


/// Synology client handles communication with download station application on NAS
pub struct SynologyClient {
  base_url: String,
  //http_client: Client<HttpConnector>
  http_delegate: HttpDelegate
}


struct HttpClientDelegate {
  http_client: Client<HttpConnector>
}

impl HttpDelegate for HttpClientDelegate {
  pub fn doPost(&mut self, url: &str, body: &str) -> HttpResult<Response>{
    let post = self.http_client.post(url);
    post.body(body).send()
  }
}

The compiler gives "error: explicit lifetime bound required" for http_delegate: HttpDelegate

mindcrime-ilab
@mindcrime-ilab
Jan 15 2015 22:16
Basically I would like to build a wrapper around the hyper::HttpClient to provide a mock for connection-less tests.