class Google::Protobuf::MethodDescriptor
Attributes
Public Class Methods
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 35 def from_native(method_def, _ = nil) return nil if method_def.nil? or method_def.null? service_def = Google::Protobuf::FFI.raw_service_def_by_raw_method_def(method_def) file_def = Google::Protobuf::FFI.file_def_by_raw_service_def(service_def) descriptor_from_file_def(file_def, method_def) end
@param service_def [::FFI::Pointer] MethodDef pointer to be wrapped @param _ [Object] Unused
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 43 def self.new(*arguments, &block) raise "Descriptor objects may not be created from Ruby." end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 95 def initialize(method_def, descriptor_pool) @method_def = method_def @descriptor_pool = descriptor_pool end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 100 def self.private_constructor(method_def, descriptor_pool) instance = allocate instance.send(:initialize, method_def, descriptor_pool) instance end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 25 def to_native(value, _) method_def_ptr = value.nil? ? nil : value.instance_variable_get(:@method_def) return ::FFI::Pointer::NULL if method_def_ptr.nil? raise "Underlying method_def was null!" if method_def_ptr.null? method_def_ptr end
@param value [MethodDescriptor] MethodDescriptor
to convert to an FFI
native type @param _ [Object] Unused
Public Instance Methods
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 76 def client_streaming @client_streaming ||= Google::Protobuf::FFI.method_client_streaming(self) end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 68 def input_type @input_type ||= Google::Protobuf::FFI.method_input_type(self) end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 51 def inspect "#{self.class.name}: #{name}" end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 55 def name @name ||= Google::Protobuf::FFI.get_method_name(self) end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 59 def options @options ||= begin size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) temporary_arena = Google::Protobuf::FFI.create_arena buffer = Google::Protobuf::FFI.method_options(self, size_ptr, temporary_arena) Google::Protobuf::MethodOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze).freeze end end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 72 def output_type @output_type ||= Google::Protobuf::FFI.method_output_type(self) end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 80 def server_streaming @server_streaming ||= Google::Protobuf::FFI.method_server_streaming(self) end
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 84 def to_proto @to_proto ||= begin size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) temporary_arena = Google::Protobuf::FFI.create_arena buffer = Google::Protobuf::FFI.method_to_proto(self, size_ptr, temporary_arena) Google::Protobuf::MethodDescriptorProto.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) end end
Private Instance Methods
Source
# File lib/google/protobuf/ffi/method_descriptor.rb, line 106 def c_type @c_type ||= Google::Protobuf::FFI.get_c_type(self) end