It's called Copy. `trait Foo: Copy { ... }`.

On Thu, Jun 12, 2014 at 10:26 AM, Tommi <[email protected]> wrote:
> I think a new keyword, something like `stable`, is needed for specifying that 
> an argument passed to a trait function is guaranteed to be logically 
> unchanged after the function call. For example:
>
> trait Foo {
>     fn foo(stable self);
> }
>
> impl Foo for int {
>     fn foo(&self) {} // OK
> }
>
> impl Foo for uint {
>     fn foo(self) {} // OK
> }
>
> impl Foo for Box<int> {
>     fn foo(stable self) {} // OK (implicitly clones self)
> }
>
>
> fn main() {
>     let x: Box<int> = box 42;
>     x.foo(); // `x` is implicitly cloned
>     x.foo(); // OK
> }
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev



-- 
http://octayn.net/
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to