// dep: ../../move-stdlib/sources/vector.move module 0x2::Collection { use std::vector; struct Collection has drop { items: vector, owner: address, } public fun borrow_mut(c: &mut Collection, i: u64): &mut T { vector::borrow_mut(&mut c.items, i) } public fun make_collection(): Collection { Collection { items: vector::empty(), owner: @0x2, } } } module 0x2::Test { use 0x2::Collection; struct Token has drop { value: u64 } public fun foo(i: u64) { let c = Collection::make_collection>(); let t = Collection::borrow_mut(&mut c, i); t.value = 0; } }