Sha256: c9497a127aba7001990e5f5844ff796008115da924cc37f5e263bcbbbd4f6799

Contents?: true

Size: 1.87 KB

Versions: 201

Compression:

Stored size: 1.87 KB

Contents

# Protocol Buffers - Google's data interchange format
# Copyright 2023 Google Inc.  All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd

require 'ffi-compiler/loader'
require 'google/protobuf/ffi/ffi'
require 'google/protobuf/ffi/internal/type_safety'
require 'google/protobuf/ffi/internal/pointer_helper'
require 'google/protobuf/ffi/internal/arena'
require 'google/protobuf/ffi/internal/convert'
require 'google/protobuf/ffi/descriptor'
require 'google/protobuf/ffi/enum_descriptor'
require 'google/protobuf/ffi/field_descriptor'
require 'google/protobuf/ffi/oneof_descriptor'
require 'google/protobuf/ffi/method_descriptor'
require 'google/protobuf/ffi/service_descriptor'
require 'google/protobuf/ffi/descriptor_pool'
require 'google/protobuf/ffi/file_descriptor'
require 'google/protobuf/ffi/map'
require 'google/protobuf/ffi/object_cache'
require 'google/protobuf/ffi/repeated_field'
require 'google/protobuf/ffi/message'

module Google
  module Protobuf
    def self.deep_copy(object)
      case object
      when RepeatedField
        RepeatedField.send(:deep_copy, object)
      when Google::Protobuf::Map
        Google::Protobuf::Map.deep_copy(object)
      when Google::Protobuf::MessageExts
        object.class.send(:deep_copy, object.instance_variable_get(:@msg))
      else
        raise NotImplementedError
      end
    end

    def self.discard_unknown(message)
      raise FrozenError if message.frozen?
      raise ArgumentError.new "Expected message, got #{message.class} instead." if message.instance_variable_get(:@msg).nil?
      unless Google::Protobuf::FFI.message_discard_unknown(message.instance_variable_get(:@msg), message.class.descriptor, 128)
        raise RuntimeError.new "Messages nested too deeply."
      end
      nil
    end
  end
end

Version data entries

201 entries across 201 versions & 2 rubygems

Version Path
google-protobuf-4.29.3-java lib/google/protobuf_ffi.rb
google-protobuf-4.29.3 lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x86_64-linux lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x86_64-darwin lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x86-mingw32 lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x86-linux lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x64-mingw32 lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-x64-mingw-ucrt lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-arm64-darwin lib/google/protobuf_ffi.rb
google-protobuf-4.29.3-aarch64-linux lib/google/protobuf_ffi.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/google-protobuf-4.29.2-x86_64-linux/lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-java lib/google/protobuf_ffi.rb
google-protobuf-4.29.2 lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x86_64-linux lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x86_64-darwin lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x86-mingw32 lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x86-linux lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x64-mingw32 lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-x64-mingw-ucrt lib/google/protobuf_ffi.rb
google-protobuf-4.29.2-arm64-darwin lib/google/protobuf_ffi.rb