These are chat archives for Ogeon/rustful

17th
Oct 2015
Vikas Kumar
@kvikas
Oct 17 2015 14:05
@Ogeon can you take a look at PR #74, test failed: https://travis-ci.org/Ogeon/rustful/jobs/85868402 . Looks like an temporary glitch.
Erik Hedvall
@Ogeon
Oct 17 2015 14:09
Yeah, I restarted it
Vikas Kumar
@kvikas
Oct 17 2015 14:15
Cool thanks. Needed some help with #70 also. It doesn't look like Box<T> can be implemented generically if there is an implementation for Fn() in scope. Box<Handler> as you suggested also did not work.
Erik Hedvall
@Ogeon
Oct 17 2015 14:19
Ugh... Ok, that's annoying. Did Box<Handler> trigger the same error?
It should work
...unless I'm missing somehting
Vikas Kumar
@kvikas
Oct 17 2015 14:23
No, it triggers 'error: the trait for<'r, 'r, 'r, 'r, 'r> core::ops::Fn<(rustful::context::Context<'r, 'r, 'r>, rustful::response::Response<'r, 'r>)> is not implem
ented for the type Box<PackagedHandler> [E0277]'
Erik Hedvall
@Ogeon
Oct 17 2015 14:23
Ah, yeah, you have to cast it to Box<Handler>
Box::new(my_handler) as Box<Handler>
Vikas Kumar
@kvikas
Oct 17 2015 14:24
Hmm ok. Don't know how casting works in rust yet
k, will try that
Erik Hedvall
@Ogeon
Oct 17 2015 14:24
That will erase the concrete type PackagedHandler and turn it into a trait object
in case you haven't
Vikas Kumar
@kvikas
Oct 17 2015 14:26
yeah that worked :-)
I'll commit changes
Erik Hedvall
@Ogeon
Oct 17 2015 14:26
:+1:
The point of implementing Handler for Box<Handler> is to allow several different boxed handler types to be stored in the same router.