These are chat archives for rust-lang/rust

Oct 2018
Ryan Levick
Oct 11 2018 08:22
Is there a way to get chunks of a vec where the chunks themselves are vecs (or at least implement IntoIter where Item = T and not &T)?
Denis Lisov
Oct 11 2018 09:29
Or possibly Vec::drain
Ryan Levick
Oct 11 2018 09:34
I worked around it, and didn't keep the original code which used drain :-( I'll try to recreare and post the code here
Rotem Yaari
Oct 11 2018 10:40

Hi, I'm trying to implement Actix-web's Responder for two types in my crate which should both be serialized the same... In both cases I just want to return them as JSON, them having derived from Serialize. I tried:

trait Renderable { }
impl Renderable for TypeA { }
impl Renderable for TypeB {}


impl<T: Renderable> Responder for T {
However, I'm getting an error that type parameter 'T' must be used as the type parameter for some local type (e.g. 'MyStruct<T>')
Does this violate the orphan rule as well? How so?
Ryan Levick
Oct 11 2018 11:33
Re: my above post. Everything become easier when I was dealing in concrete types I could name (my code is dealing with a struct that implements future and is built using combinators which makes it hard to directly reference in code).
split_off was definitely the right way to go
Oct 11 2018 14:46
@vmalloc use PhantomData.