Rustで値のmoveが起こる場合


Rust v.0.11pre

Rust


C++

RustOwnershipborrowingABABArc<T>使

OwnershipmutabilityborrowingSend kind

Rustshallow copy
let xs = Cons(1, box Cons(2, box Cons(3, box Nil)));
let ys = xs; // copies `Cons(u32, pointer)` shallowly



owning pointerownership2Ownership

RustownershipConsxyysxy使

RustOwnership




Rustcopymove




owning pointerBox<T>

Drop trait

Type kindsDropDropkindSend+Drop.



DefaultDrop::drop()

vector[int, ..10]

Vec<T>&[T]





return

returnreturnreturnmove





opaquemove

<T: Copy>Copy kindcopy



proc



Sendkind