y = &x[0]; x.push("foo"); } error: cannot borrow `x` as mutable because it is also borrowed as immutable x.push("foo"); ^ note: previous borrow of `x` occurs here; the immutable borrow prevents subsequent moves or mutable borrows of `x` until the borrow ends let y = &x[0]; ^ note: previous borrow ends here fn main() { } ^
method_name self[:method_name] end def count self[:count] end end class Report < FFI::Struct include Enumerable layout :length, :uint, :call_counts, :pointer def each self[:length].times do |i| yield CallCount.new(self[:call_counts] + (i * CallCount.size)) end end end