> How do I manually implement "clone()" for  Structs/Enums with lifetime
> parameters (e.g. for struct below)?
>
> ---------------------------------------------------
> struct Cls<'a,T> {
>       x:&'a T
> }

impl<'a, T: Clone> Clone for Cls<'a, T> {
    fn clone(&self) -> Cls<'a, T> {
        Cls { x: self.x }
    }
}

You may find the generics [1] and traits [2] sections of the tutorial
helpful as well!

[1] - http://static.rust-lang.org/doc/master/tutorial.html#generics
[2] - http://static.rust-lang.org/doc/master/tutorial.html#traits
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to