Class: FFI::StructLayout

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb

Defined Under Namespace

Classes: Enum, InnerStruct, Mapped

Instance Method Summary collapse

Instance Method Details

#offset_of(field_name) ⇒ Numeric

Get the offset of a field.

Returns:



46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 46

def offset_of(field_name)
  self[field_name].offset
end

#offsetsArray<Array(Symbol, Numeric)>

Get an array of tuples (field name, offset of the field).

Returns:



40
41
42
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/lib/ffi/struct_layout.rb', line 40

def offsets
  members.map { |m| [ m, self[m].offset ] }
end