123456789_123456789_123456789_123456789_123456789_

Class: FFI::Struct::ManagedStructConverter

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: FFI::StructByReference
Defined in: lib/ffi/struct.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::FFI::StructByReference - Inherited

#from_native

Create a struct from content of memory value.

#native_type

Always get ::FFI::Type::POINTER.

#to_native

::FFI::DataConverter - Included

#from_native

Convert from a native type.

#native_type

Get native type.

#to_native

Convert to a native type.

Constructor Details

.new(struct_class) ⇒ ManagedStructConverter

Parameters:

Raises:

  • (NoMethodError)
[ GitHub ]

  
# File 'lib/ffi/struct.rb', line 150

def initialize(struct_class)
  super(struct_class)

  raise NoMethodError, "release() not implemented for class #{struct_class}" unless struct_class.respond_to? :release
  @method = struct_class.method(:release)
end

Instance Method Details

#from_native(ptr, ctx) ⇒ Struct

Parameters:

[ GitHub ]

  
# File 'lib/ffi/struct.rb', line 160

def from_native(ptr, ctx)
  struct_class.new(AutoPointer.new(ptr, @method))
end