123456789_123456789_123456789_123456789_123456789_

Class: FFI::StructLayout::InnerStruct

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Field
Instance Chain:
self, Field
Inherits: FFI::StructLayout::Field
Defined in: lib/ffi/struct_layout.rb

Class Method Summary

Field - Inherited

Instance Method Summary

Constructor Details

This class inherits a constructor from FFI::StructLayout::Field

Instance Method Details

#get(ptr)

[ GitHub ]

  
# File 'lib/ffi/struct_layout.rb', line 71

def get(ptr)
  type.struct_class.new(ptr.slice(self.offset, self.size))
end

#put(ptr, value)

Raises:

  • (TypeError)
[ GitHub ]

  
# File 'lib/ffi/struct_layout.rb', line 75

def put(ptr, value)
  raise TypeError, "wrong value type (expected #{type.struct_class})" unless value.is_a?(type.struct_class)
  ptr.slice(self.offset, self.size).__copy_from__(value.pointer, self.size)
end