attach_function :new_usage, [], :pointer attach_function :record, [:pointer, :string, :string, :int, :string, :string], :void attach_function :report, [:pointer], Report.by_value end def initialize @usage = Rust.new_usage end def attach set_trace_func proc { |event, file, line, id, binding, classname| Rust.record(@usage, event, file, line, id.to_s, classname.to_s) } end def report Rust.report(@usage) end end end