These are chat archives for rust-lang/rust

10th
Aug 2017
Restioson
@Restioson
Aug 10 2017 04:35
Glad you solved it :smile:
Timmy Jose
@timmyjose
Aug 10 2017 12:57
Hey folks, can anybody give me a good resource to learn about impl traits and its use cases?
Aleksey Kladov
@matklad
Aug 10 2017 13:13
@timmyjose I don't know about a super great resource, but the RFC might be a good place to start: https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md#motivation
Timmy Jose
@timmyjose
Aug 10 2017 13:19
@matklad Okay, that looks like a good place to start with. Thank you!
Igor
@target-san
Aug 10 2017 16:12

I just discovered that #[derive(Clone)] struct Foo<T> { ... } will produce

impl<T: ::std::clone::Clone> ::std::clone::Clone for Foo<T> { ... }

But I don't want such constraints on generic type - because my type is kind of shared pointer. Is there a way to circumvent this?

Diggory Blake
@Diggsey
Aug 10 2017 16:19
no, you have to implement Clone manually
Igor
@target-san
Aug 10 2017 16:25
Dang. That's a pain.