jonbinney/ros_rust

Update to 1.2

Opened this issue · 5 comments

1.2.0 is the latest stable version of Rust.

I started the effort in this branch, though it doesn't currently compile:

https://github.com/jacquelinekay/ros_rust/tree/update_to_1.2

(note: updating this library is my first foray into Rust, so no guarantees that anything I've done is correct!)

tulku commented

Hi! We have been working on this also. Besides the changes you did, we are replacing the custom http and xml libraries for hyper and xml-rs. We got a bit delayed on making some changes to the xmlrpc library (to use the new libs and add some functionality). The xmlrpc library is located here: https://github.com/creativa77/xmlrpc-rs

cool. In my branch, I think I've updated all the API changes that caused syntactical errors, but now I'm scratching my head over a type lifetime issue that's preventing compilation. Perhaps someone with more Rust experience than I can advise:

http/server.rs:27:32: 29:15 error: the parameter type `H` may not live long enough [E0310]
http/server.rs:27             Ok(stream) => pool.execute(move || {
http/server.rs:28                 handle_incoming_request(stream, handler_clone);
http/server.rs:29             }),
note: in expansion of for loop expansion
http/server.rs:22:5: 31:6 note: expansion site
http/server.rs:27:32: 29:15 help: run `rustc --explain E0310` to see a detailed explanation
http/server.rs:27:32: 29:15 help: consider adding an explicit lifetime bound `H: 'static`...
http/server.rs:27:32: 29:15 note: ...so that the type `[closure@http/server.rs:27:40: 29:14 stream:std::net::tcp::TcpStream, handler_clone:H]` will meet its required lifetime bounds
http/server.rs:27             Ok(stream) => pool.execute(move || {
http/server.rs:28                 handle_incoming_request(stream, handler_clone);
http/server.rs:29             }),

"H" is the type of the handler function, in this case, "handler_clone". Since this is a move closure, I would expect it to make a new copy of handler_clone anyway, so the lifetime shouldn't matter (I think?). So I'm not sure what is happening here.

I only wrote that http stuff because there wasn't a clear good http library when i started. I think that using hyper is the right way to do it. @tulku how well does xmlrpc-rs work? @jacquelinekay we should switch ros_rust over to use that since it uses hyper, and then this whole part of the code won't be needed anymore.

Indeed, I can try integrating xmlrpc-rs if @tulku and co think it's ready
(or even if its just mostly ready and the API is there)
On Aug 30, 2015 10:16 PM, "Jonathan Binney" notifications@github.com
wrote:

"H" is the type of the handler function, in this case, "handler_clone".
Since this is a move closure, I would expect it to make a new copy of
handler_clone anyway, so the lifetime shouldn't matter (I think?). So I'm
not sure what is happening here.

I only wrote that http stuff because there wasn't a clear good http
library when i started. I think that using hyper is the right way to do it.
@tulku https://github.com/tulku how well does xmlrpc-rs work?
@jacquelinekay https://github.com/jacquelinekay we should switch
ros_rust over to use that since it uses hyper, and then this whole part of
the code won't be needed anymore.


Reply to this email directly or view it on GitHub
#5 (comment).

tulku commented

Hi! Unfortunately, it is not ready... It's able to start a http server using hyper. I have a client that it is not merged. It has the beginning of a xml request parser, which only passes the one test. Hopefully I'll be able to put more hours into it these days. However, if somebody want to contribute to it, in any way, it's more than welcomed.