lib/rust_require/ruby_wrapper_generator.rb
# attaches structs via FFI to mod
attaches structs via FFI to mod
attaches structs via FFI to mod
def attach_structs(struct_defs, mod)
      struct_defs.each do |s|
        fields = s['fields'].map do |name, type|
          type = Rust::Types.find_type(type)
          [name.to_sym, type.ffi_output_type]
        end.flatten
        struct = Class.new(Rust::Struct)
        struct.layout *fields
        mod.const_set(s['name'], struct)
      end
    end
def attach_structs ( struct_defs , mod ) struct_defs . each do | s | fields = s [ 'fields' ] . map do | name , type | type = Rust :: Types . find_type ( type ) [ name . to_sym , type . ffi_output_type ] end . flatten struct = Class . new ( Rust :: Struct ) struct . layout * fields mod . const_set ( s [ 'name' ] , struct ) end end
attaches structs via FFI to mod
attaches structs via FFI to mod
struct_defs
<not_specific>
mod
<not_specific>