And an additional question.
3. What is the rationale in having both Copy and Clone?  Can one
provide an exhaustive list for where one would want to use Copy
instead of Clone/DeepClone?  I tried to use clone everywhere, but I
needed <T : Copy + Zero> to be able to write, for example,
[Zero::zero(),.. 3] as in the following code
----
struct V<T> {
    v : [T, ..3]
}

impl<T : Copy + Zero> V<T> {
    pub fn new() -> V<T> {
        V { v: [Zero::zero(), ..3] }
    }
}
----
(As the actual code was from a macro that was parametrized by the
number of elements, I don't want to simply rewrite the initialization
above as [Zero::zero(), Zero::zero(), Zero::zero()] to avoid the
dependence on Copy.)
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to