### Home Classes Methods

### In Files

- lib/ffi/struct.rb

### Parent

Object

### Namespace

- CLASS FFI::StructLayout::Enum
- CLASS FFI::StructLayout::InnerStruct
- CLASS FFI::StructLayout::Mapped

### Methods

- #offset_of
- #offsets

### Files

- Makefile
- ChangeLog
- LICENSE
- README
- compile
- configure
- depcomp
- stamp-vti
- install-sh
- libtool-version
- mdate-sh
- missing

### Class/Module Index

Quicksearch

- FFI
- FFI::AbstractMemory
- FFI::AutoPointer
- FFI::AutoPointer::CallableReleaser
- FFI::AutoPointer::DefaultReleaser
- FFI::AutoPointer::Releaser
- FFI::ConstGenerator
- FFI::ConstGenerator::Constant
- FFI::DataConverter
- FFI::DynamicLibrary
- FFI::DynamicLibrary::Symbol
- FFI::Enum
- FFI::Enums
- FFI::Function
- FFI::FunctionType
- FFI::Generator
- FFI::Generator::Task
- FFI::IO
- FFI::LastError
- FFI::Library
- FFI::ManagedStruct
- FFI::MemoryPointer
- FFI::NativeType
- FFI::NotFoundError
- FFI::NullPointerError
- FFI::Platform
- FFI::PlatformError
- FFI::Pointer
- FFI::StrPtrConverter
- FFI::Struct
- FFI::Struct::InlineArray
- FFI::Struct::ManagedStructConverter
- FFI::StructByValue
- FFI::StructGenerator
- FFI::StructGenerator::Field
- FFI::StructLayout
- FFI::StructLayout::Enum
- FFI::StructLayout::InnerStruct
- FFI::StructLayout::Mapped
- FFI::StructLayoutBuilder
- FFI::Type
- FFI::Type::Builtin
- FFI::TypesGenerator
- FFI::Union
- FFI::VariadicInvoker

No matching classes.

# FFI::StructLayout

### Public Instance Methods

offset_of(field_name) click to toggle source

@return [Numeric] Get the offset of a field.

    # File lib/ffi/struct.rb, line 38
    def offset_of(field_name)
      self[field_name].offset
    end

offsets() click to toggle source

@return [Array<Array(Symbol, Numeric)> Get an array of tuples (field name, offset of the field).

    # File lib/ffi/struct.rb, line 32
    def offsets
      members.map { |m| [ m, self[m].offset ] }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.