class Google::Protobuf::Internal::Arena

Attributes

pinned_messages[R]

Public Class Methods

from_native(value, _) click to toggle source

@param value [::FFI::Pointer] Arena pointer to be wrapped @param _ [Object] Unused

# File lib/google/protobuf/ffi/internal/arena.rb, line 33
def from_native(value, _)
  new(value)
end
new(pointer) click to toggle source
# File lib/google/protobuf/ffi/internal/arena.rb, line 38
def initialize(pointer)
  @arena = ::FFI::AutoPointer.new(pointer, Google::Protobuf::FFI.method(:free_arena))
  @pinned_messages = []
end
to_native(value, _) click to toggle source

@param value [Arena] Arena to convert to an FFI native type @param _ [Object] Unused

# File lib/google/protobuf/ffi/internal/arena.rb, line 26
def to_native(value, _)
  value.instance_variable_get(:@arena) || ::FFI::Pointer::NULL
end

Public Instance Methods

fuse(other_arena) click to toggle source
# File lib/google/protobuf/ffi/internal/arena.rb, line 43
def fuse(other_arena)
  return if other_arena == self
  unless Google::Protobuf::FFI.fuse_arena(self, other_arena)
    raise RuntimeError.new "Unable to fuse arenas. This should never happen since Ruby does not use initial blocks"
  end
end
pin(message) click to toggle source
# File lib/google/protobuf/ffi/internal/arena.rb, line 50
def pin(message)
  pinned_messages.push message
end