hangups-rs

Rust version of hangups (WIP) Currently Login not possible
git clone git://archive.git.mtrnord.blog/Nordgedanken/hangups-rs.git
Log | Files | Refs | README | LICENSE

commit fe84d861a72d379359f2835f10bce0092ed52c54
parent 554f1a71db5bd6ea6b47638373ddc32907caf3fa
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sat, 22 Apr 2017 21:41:36 +0200

some reworking

Diffstat:
Mlog.txt | 25++++++++++---------------
Msrc/lib.rs | 22+++++++++++++---------
2 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/log.txt b/log.txt @@ -1,23 +1,18 @@ Compiling hangups v0.0.1 (file:///source) -error[E0382]: use of moved value: `res` - --> src/lib.rs:236:55 +error: no method named `deconstruct` found for type `hyper::client::FutureResponse` in the current scope + --> src/lib.rs:235:46 | -235 | let body = format!("{:?}", res.body()); - | --- value moved here -236 | do_auth_step(&client, email_uri, &res, body.as_str(), client_email, client_passwd, &res.headers()); - | ^^^ value used here after move - | - = note: move occurs because `res` has type `hyper::client::Response`, which does not implement the `Copy` trait +235 | let (_, uri, _, headers, body) = req.deconstruct(); + | ^^^^^^^^^^^ -error[E0382]: use of moved value: `res` - --> src/lib.rs:236:105 +error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied + --> src/lib.rs:235:34 | -235 | let body = format!("{:?}", res.body()); - | --- value moved here -236 | do_auth_step(&client, email_uri, &res, body.as_str(), client_email, client_passwd, &res.headers()); - | ^^^ value used here after move +235 | let (_, uri, _, headers, body) = req.deconstruct(); + | ^^^^ the trait `std::marker::Sized` is not implemented for `str` | - = note: move occurs because `res` has type `hyper::client::Response`, which does not implement the `Copy` trait + = note: `str` does not have a constant size known at compile-time + = note: all local variables must have a statically known size error: aborting due to 2 previous errors diff --git a/src/lib.rs b/src/lib.rs @@ -15,7 +15,7 @@ pub mod auth { use hyper::client::{Response, HttpConnector}; use tokio_core::reactor::Core; use hyper::header::Headers; - fn do_auth_step(client: &Client<HttpConnector, Body>, url: Uri, resp: &Response, resp_body: &str, email: String, password: String, mut resp_headers_raw: &Headers) { + fn do_auth_step(client: &Client<HttpConnector, Body>, url: Uri, resp_body: &str, email: String, password: String, mut resp_headers_raw: &Headers) { use hyper::header::{Headers, SetCookie, UserAgent}; use hyper::client::Request; use hyper::{Method, Uri}; @@ -231,14 +231,18 @@ pub mod auth { println!("You typed: {}", client_passwd); // Login Step1 - let req = client.get(auth_uri).and_then(|res| { - let body = format!("{:?}", res.body()); - do_auth_step(&client, email_uri, &res, body.as_str(), client_email, client_passwd, &res.headers()); - Ok(()) - }) - .map(|_| { - println!("\n\nDone."); - }); + let req = client.get(auth_uri); + let (_, uri, _, headers, body) = req.deconstruct(); + do_auth_step(&client, email_uri, &body, client_email, client_passwd, headers); + + // .and_then(|res| { + // let body = format!("{:?}", (res).body()); + // do_auth_step(&client, email_uri, &res, &body, client_email, client_passwd, &res.headers()); + // Ok(()) + // }) + // .map(|_| { + // println!("\n\nDone."); + // }); core.run(req).unwrap(); }