google-protobuf 4.29.1 → 4.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/convert.c +3 -10
- data/ext/google/protobuf_c/defs.c +469 -130
- data/ext/google/protobuf_c/extconf.rb +20 -10
- data/ext/google/protobuf_c/glue.c +63 -0
- data/ext/google/protobuf_c/map.c +76 -39
- data/ext/google/protobuf_c/message.c +96 -62
- data/ext/google/protobuf_c/protobuf.c +3 -2
- data/ext/google/protobuf_c/protobuf.h +0 -8
- data/ext/google/protobuf_c/repeated_field.c +75 -38
- data/ext/google/protobuf_c/ruby-upb.c +14055 -13540
- data/ext/google/protobuf_c/ruby-upb.h +4343 -2827
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.c +21 -281
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range_neon.inc +117 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range_sse.inc +272 -0
- data/lib/google/protobuf/any_pb.rb +1 -1
- data/lib/google/protobuf/api_pb.rb +2 -2
- data/lib/google/protobuf/descriptor_pb.rb +6 -2
- data/lib/google/protobuf/duration_pb.rb +1 -1
- data/lib/google/protobuf/empty_pb.rb +1 -1
- data/lib/google/protobuf/ffi/descriptor.rb +10 -0
- data/lib/google/protobuf/ffi/descriptor_pool.rb +3 -1
- data/lib/google/protobuf/ffi/enum_descriptor.rb +10 -0
- data/lib/google/protobuf/ffi/ffi.rb +0 -1
- data/lib/google/protobuf/ffi/field_descriptor.rb +16 -0
- data/lib/google/protobuf/ffi/file_descriptor.rb +36 -0
- data/lib/google/protobuf/ffi/internal/convert.rb +1 -5
- data/lib/google/protobuf/ffi/internal/pointer_helper.rb +2 -1
- data/lib/google/protobuf/ffi/map.rb +2 -2
- data/lib/google/protobuf/ffi/message.rb +2 -4
- data/lib/google/protobuf/ffi/method_descriptor.rb +11 -1
- data/lib/google/protobuf/ffi/oneof_descriptor.rb +10 -0
- data/lib/google/protobuf/ffi/service_descriptor.rb +11 -1
- data/lib/google/protobuf/field_mask_pb.rb +1 -1
- data/lib/google/protobuf/message_exts.rb +4 -0
- data/lib/google/protobuf/plugin_pb.rb +1 -1
- data/lib/google/protobuf/source_context_pb.rb +1 -1
- data/lib/google/protobuf/struct_pb.rb +1 -1
- data/lib/google/protobuf/timestamp_pb.rb +1 -1
- data/lib/google/protobuf/type_pb.rb +1 -1
- data/lib/google/protobuf/wrappers_pb.rb +1 -1
- data/lib/google/protobuf_ffi.rb +3 -2
- data/lib/google/tasks/ffi.rake +1 -1
- metadata +23 -22
- data/ext/google/protobuf_c/wrap_memcpy.c +0 -29
|
@@ -93,9 +93,15 @@ const upb_DefPool* DescriptorPool_GetSymtab(VALUE desc_pool_rb) {
|
|
|
93
93
|
return pool->symtab;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/**
|
|
97
|
+
* ruby-doc: DescriptorPool
|
|
98
|
+
*
|
|
99
|
+
* A DescriptorPool is the registry of all known Protobuf descriptor objects.
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
|
|
96
103
|
/*
|
|
97
|
-
*
|
|
98
|
-
* DescriptorPool.new => pool
|
|
104
|
+
* ruby-doc: DescriptorPool.new
|
|
99
105
|
*
|
|
100
106
|
* Creates a new, empty, descriptor pool.
|
|
101
107
|
*/
|
|
@@ -112,10 +118,14 @@ static VALUE DescriptorPool_alloc(VALUE klass) {
|
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
/*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
121
|
+
* ruby-doc: DescriptorPool#add_serialized_file
|
|
122
|
+
*
|
|
123
|
+
* Adds the given serialized
|
|
124
|
+
* {https://protobuf.com/docs/descriptors#file-descriptors FileDescriptorProto}
|
|
125
|
+
* to the pool.
|
|
117
126
|
*
|
|
118
|
-
*
|
|
127
|
+
* @param serialized_file_proto [String]
|
|
128
|
+
* @return [FileDescriptor]
|
|
119
129
|
*/
|
|
120
130
|
VALUE DescriptorPool_add_serialized_file(VALUE _self,
|
|
121
131
|
VALUE serialized_file_proto) {
|
|
@@ -143,11 +153,14 @@ VALUE DescriptorPool_add_serialized_file(VALUE _self,
|
|
|
143
153
|
}
|
|
144
154
|
|
|
145
155
|
/*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
156
|
+
* ruby-doc: DescriptorPool#lookup
|
|
157
|
+
*
|
|
158
|
+
* Finds a {Descriptor}, {EnumDescriptor},
|
|
159
|
+
* {FieldDescriptor} or {ServiceDescriptor} by
|
|
160
|
+
* name and returns it, or nil if none exists with the given name.
|
|
148
161
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
162
|
+
* @param name [String]
|
|
163
|
+
* @return [Descriptor,EnumDescriptor,FieldDescriptor,ServiceDescriptor]
|
|
151
164
|
*/
|
|
152
165
|
static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
|
|
153
166
|
DescriptorPool* self = ruby_to_DescriptorPool(_self);
|
|
@@ -156,6 +169,7 @@ static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
|
|
|
156
169
|
const upb_EnumDef* enumdef;
|
|
157
170
|
const upb_FieldDef* fielddef;
|
|
158
171
|
const upb_ServiceDef* servicedef;
|
|
172
|
+
const upb_FileDef* filedef;
|
|
159
173
|
|
|
160
174
|
msgdef = upb_DefPool_FindMessageByName(self->symtab, name_str);
|
|
161
175
|
if (msgdef) {
|
|
@@ -177,17 +191,23 @@ static VALUE DescriptorPool_lookup(VALUE _self, VALUE name) {
|
|
|
177
191
|
return get_servicedef_obj(_self, servicedef);
|
|
178
192
|
}
|
|
179
193
|
|
|
194
|
+
filedef = upb_DefPool_FindFileByName(self->symtab, name_str);
|
|
195
|
+
if (filedef) {
|
|
196
|
+
return get_filedef_obj(_self, filedef);
|
|
197
|
+
}
|
|
198
|
+
|
|
180
199
|
return Qnil;
|
|
181
200
|
}
|
|
182
201
|
|
|
183
202
|
/*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
203
|
+
* ruby-doc: DescriptorPool.generated_pool
|
|
204
|
+
*
|
|
205
|
+
* Class method that returns the global {DescriptorPool}. This is a singleton
|
|
206
|
+
* into which generated-code message and enum types are registered. The user may
|
|
207
|
+
* also register types in this pool for convenience so that they do not have to
|
|
208
|
+
* hold a reference to a private pool instance.
|
|
186
209
|
*
|
|
187
|
-
*
|
|
188
|
-
* which generated-code message and enum types are registered. The user may also
|
|
189
|
-
* register types in this pool for convenience so that they do not have to hold
|
|
190
|
-
* a reference to a private pool instance.
|
|
210
|
+
* @return [DescriptorPool]
|
|
191
211
|
*/
|
|
192
212
|
static VALUE DescriptorPool_generated_pool(VALUE _self) {
|
|
193
213
|
return generated_pool;
|
|
@@ -284,8 +304,13 @@ static VALUE decode_options(VALUE self, const char* option_type, int size,
|
|
|
284
304
|
}
|
|
285
305
|
|
|
286
306
|
/*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
307
|
+
* ruby-doc: Descriptor
|
|
308
|
+
*
|
|
309
|
+
* A Descriptor provides information about a given Protobuf definition.
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
/*
|
|
313
|
+
* ruby-doc: Descriptor.initialize
|
|
289
314
|
*
|
|
290
315
|
* Creates a new, empty, message type descriptor. At a minimum, its name must be
|
|
291
316
|
* set before it is added to a pool. It cannot be used to create messages until
|
|
@@ -323,10 +348,11 @@ static VALUE Descriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
323
348
|
}
|
|
324
349
|
|
|
325
350
|
/*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
351
|
+
* ruby-doc: Descriptor#file_descriptor
|
|
352
|
+
*
|
|
353
|
+
* Returns the {FileDescriptor} object this message belongs to.
|
|
328
354
|
*
|
|
329
|
-
*
|
|
355
|
+
* @return [FileDescriptor]
|
|
330
356
|
*/
|
|
331
357
|
static VALUE Descriptor_file_descriptor(VALUE _self) {
|
|
332
358
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -335,11 +361,12 @@ static VALUE Descriptor_file_descriptor(VALUE _self) {
|
|
|
335
361
|
}
|
|
336
362
|
|
|
337
363
|
/*
|
|
338
|
-
*
|
|
339
|
-
* Descriptor.name => name
|
|
364
|
+
* ruby-doc: Descriptor#name
|
|
340
365
|
*
|
|
341
366
|
* Returns the name of this message type as a fully-qualified string (e.g.,
|
|
342
367
|
* My.Package.MessageType).
|
|
368
|
+
*
|
|
369
|
+
* @return [String]
|
|
343
370
|
*/
|
|
344
371
|
static VALUE Descriptor_name(VALUE _self) {
|
|
345
372
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -347,10 +374,12 @@ static VALUE Descriptor_name(VALUE _self) {
|
|
|
347
374
|
}
|
|
348
375
|
|
|
349
376
|
/*
|
|
350
|
-
*
|
|
351
|
-
* Descriptor.each(&block)
|
|
377
|
+
* ruby-doc: Descriptor#each
|
|
352
378
|
*
|
|
353
379
|
* Iterates over fields in this message type, yielding to the block on each one.
|
|
380
|
+
*
|
|
381
|
+
* @yield [FieldDescriptor]
|
|
382
|
+
* @return [nil]
|
|
354
383
|
*/
|
|
355
384
|
static VALUE Descriptor_each(VALUE _self) {
|
|
356
385
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -365,11 +394,13 @@ static VALUE Descriptor_each(VALUE _self) {
|
|
|
365
394
|
}
|
|
366
395
|
|
|
367
396
|
/*
|
|
368
|
-
*
|
|
369
|
-
* Descriptor.lookup(name) => FieldDescriptor
|
|
397
|
+
* ruby-doc: Descriptor#lookup
|
|
370
398
|
*
|
|
371
399
|
* Returns the field descriptor for the field with the given name, if present,
|
|
372
400
|
* or nil if none.
|
|
401
|
+
*
|
|
402
|
+
* @param name [String]
|
|
403
|
+
* @return [FieldDescriptor]
|
|
373
404
|
*/
|
|
374
405
|
static VALUE Descriptor_lookup(VALUE _self, VALUE name) {
|
|
375
406
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -382,11 +413,13 @@ static VALUE Descriptor_lookup(VALUE _self, VALUE name) {
|
|
|
382
413
|
}
|
|
383
414
|
|
|
384
415
|
/*
|
|
385
|
-
*
|
|
386
|
-
* Descriptor.each_oneof(&block) => nil
|
|
416
|
+
* ruby-doc: Descriptor#each_oneof
|
|
387
417
|
*
|
|
388
418
|
* Invokes the given block for each oneof in this message type, passing the
|
|
389
|
-
* corresponding OneofDescriptor.
|
|
419
|
+
* corresponding {OneofDescriptor}.
|
|
420
|
+
*
|
|
421
|
+
* @yield [OneofDescriptor]
|
|
422
|
+
* @return [nil]
|
|
390
423
|
*/
|
|
391
424
|
static VALUE Descriptor_each_oneof(VALUE _self) {
|
|
392
425
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -401,11 +434,13 @@ static VALUE Descriptor_each_oneof(VALUE _self) {
|
|
|
401
434
|
}
|
|
402
435
|
|
|
403
436
|
/*
|
|
404
|
-
*
|
|
405
|
-
* Descriptor.lookup_oneof(name) => OneofDescriptor
|
|
437
|
+
* ruby-doc: Descriptor#lookup_oneof
|
|
406
438
|
*
|
|
407
439
|
* Returns the oneof descriptor for the oneof with the given name, if present,
|
|
408
440
|
* or nil if none.
|
|
441
|
+
*
|
|
442
|
+
* @param name [String]
|
|
443
|
+
* @return [OneofDescriptor]
|
|
409
444
|
*/
|
|
410
445
|
static VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name) {
|
|
411
446
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -418,10 +453,11 @@ static VALUE Descriptor_lookup_oneof(VALUE _self, VALUE name) {
|
|
|
418
453
|
}
|
|
419
454
|
|
|
420
455
|
/*
|
|
421
|
-
*
|
|
422
|
-
* Descriptor.msgclass => message_klass
|
|
456
|
+
* ruby-doc: Descriptor#msgclass
|
|
423
457
|
*
|
|
424
458
|
* Returns the Ruby class created for this message type.
|
|
459
|
+
*
|
|
460
|
+
* @return [Class<Google::Protobuf::AbstractMessage>]
|
|
425
461
|
*/
|
|
426
462
|
static VALUE Descriptor_msgclass(VALUE _self) {
|
|
427
463
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -432,10 +468,13 @@ static VALUE Descriptor_msgclass(VALUE _self) {
|
|
|
432
468
|
}
|
|
433
469
|
|
|
434
470
|
/*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
471
|
+
* ruby-doc: Descriptor#options
|
|
472
|
+
*
|
|
473
|
+
* Returns the
|
|
474
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L571
|
|
475
|
+
* MessageOptions} for this {Descriptor}.
|
|
437
476
|
*
|
|
438
|
-
*
|
|
477
|
+
* @return [MessageOptions]
|
|
439
478
|
*/
|
|
440
479
|
static VALUE Descriptor_options(VALUE _self) {
|
|
441
480
|
Descriptor* self = ruby_to_Descriptor(_self);
|
|
@@ -451,6 +490,30 @@ static VALUE Descriptor_options(VALUE _self) {
|
|
|
451
490
|
return message_options;
|
|
452
491
|
}
|
|
453
492
|
|
|
493
|
+
/*
|
|
494
|
+
* ruby-doc: Descriptor#to_proto
|
|
495
|
+
*
|
|
496
|
+
* Returns the
|
|
497
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L147
|
|
498
|
+
* DescriptorProto} of this {Descriptor}.
|
|
499
|
+
*
|
|
500
|
+
* @return [DescriptorProto]
|
|
501
|
+
*/
|
|
502
|
+
static VALUE Descriptor_to_proto(VALUE _self) {
|
|
503
|
+
Descriptor* self = ruby_to_Descriptor(_self);
|
|
504
|
+
upb_Arena* arena = upb_Arena_New();
|
|
505
|
+
google_protobuf_DescriptorProto* proto =
|
|
506
|
+
upb_MessageDef_ToProto(self->msgdef, arena);
|
|
507
|
+
size_t size;
|
|
508
|
+
const char* serialized =
|
|
509
|
+
google_protobuf_DescriptorProto_serialize(proto, arena, &size);
|
|
510
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::DescriptorProto");
|
|
511
|
+
VALUE proto_rb =
|
|
512
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
513
|
+
upb_Arena_Free(arena);
|
|
514
|
+
return proto_rb;
|
|
515
|
+
}
|
|
516
|
+
|
|
454
517
|
static void Descriptor_register(VALUE module) {
|
|
455
518
|
VALUE klass = rb_define_class_under(module, "Descriptor", rb_cObject);
|
|
456
519
|
rb_define_alloc_func(klass, Descriptor_alloc);
|
|
@@ -463,6 +526,7 @@ static void Descriptor_register(VALUE module) {
|
|
|
463
526
|
rb_define_method(klass, "name", Descriptor_name, 0);
|
|
464
527
|
rb_define_method(klass, "file_descriptor", Descriptor_file_descriptor, 0);
|
|
465
528
|
rb_define_method(klass, "options", Descriptor_options, 0);
|
|
529
|
+
rb_define_method(klass, "to_proto", Descriptor_to_proto, 0);
|
|
466
530
|
rb_include_module(klass, rb_mEnumerable);
|
|
467
531
|
rb_gc_register_address(&cDescriptor);
|
|
468
532
|
cDescriptor = klass;
|
|
@@ -506,9 +570,15 @@ static VALUE FileDescriptor_alloc(VALUE klass) {
|
|
|
506
570
|
return ret;
|
|
507
571
|
}
|
|
508
572
|
|
|
573
|
+
/**
|
|
574
|
+
* ruby-doc: FileDescriptor
|
|
575
|
+
*
|
|
576
|
+
* A FileDescriptor provides information about all Protobuf definitions in a
|
|
577
|
+
* particular file.
|
|
578
|
+
*/
|
|
579
|
+
|
|
509
580
|
/*
|
|
510
|
-
*
|
|
511
|
-
* FileDescriptor.new => file
|
|
581
|
+
* ruby-doc: FileDescriptor#initialize
|
|
512
582
|
*
|
|
513
583
|
* Returns a new file descriptor. May
|
|
514
584
|
* to a builder.
|
|
@@ -529,10 +599,11 @@ static VALUE FileDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
529
599
|
}
|
|
530
600
|
|
|
531
601
|
/*
|
|
532
|
-
*
|
|
533
|
-
* FileDescriptor.name => name
|
|
602
|
+
* ruby-doc: FileDescriptor#name
|
|
534
603
|
*
|
|
535
604
|
* Returns the name of the file.
|
|
605
|
+
*
|
|
606
|
+
* @return [String]
|
|
536
607
|
*/
|
|
537
608
|
static VALUE FileDescriptor_name(VALUE _self) {
|
|
538
609
|
FileDescriptor* self = ruby_to_FileDescriptor(_self);
|
|
@@ -541,10 +612,13 @@ static VALUE FileDescriptor_name(VALUE _self) {
|
|
|
541
612
|
}
|
|
542
613
|
|
|
543
614
|
/*
|
|
544
|
-
*
|
|
545
|
-
* FileDescriptor.options => options
|
|
615
|
+
* ruby-doc: FileDescriptor#options
|
|
546
616
|
*
|
|
547
|
-
* Returns the
|
|
617
|
+
* Returns the
|
|
618
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L442
|
|
619
|
+
* FileOptions} for this {FileDescriptor}.
|
|
620
|
+
*
|
|
621
|
+
* @return [FileOptions]
|
|
548
622
|
*/
|
|
549
623
|
static VALUE FileDescriptor_options(VALUE _self) {
|
|
550
624
|
FileDescriptor* self = ruby_to_FileDescriptor(_self);
|
|
@@ -558,12 +632,40 @@ static VALUE FileDescriptor_options(VALUE _self) {
|
|
|
558
632
|
return file_options;
|
|
559
633
|
}
|
|
560
634
|
|
|
635
|
+
/*
|
|
636
|
+
* ruby-doc: FileDescriptor#to_proto
|
|
637
|
+
*
|
|
638
|
+
* Returns the
|
|
639
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L104
|
|
640
|
+
* FileDescriptorProto} of this {FileDescriptor}.
|
|
641
|
+
*
|
|
642
|
+
* @return [FileDescriptorProto]
|
|
643
|
+
*/
|
|
644
|
+
static VALUE FileDescriptor_to_proto(VALUE _self) {
|
|
645
|
+
FileDescriptor* self = ruby_to_FileDescriptor(_self);
|
|
646
|
+
upb_Arena* arena = upb_Arena_New();
|
|
647
|
+
google_protobuf_FileDescriptorProto* file_proto =
|
|
648
|
+
upb_FileDef_ToProto(self->filedef, arena);
|
|
649
|
+
|
|
650
|
+
size_t size;
|
|
651
|
+
const char* serialized =
|
|
652
|
+
google_protobuf_FileDescriptorProto_serialize(file_proto, arena, &size);
|
|
653
|
+
|
|
654
|
+
VALUE file_proto_class =
|
|
655
|
+
rb_path2class("Google::Protobuf::FileDescriptorProto");
|
|
656
|
+
VALUE proto_rb =
|
|
657
|
+
Message_decode_bytes(size, serialized, 0, file_proto_class, false);
|
|
658
|
+
upb_Arena_Free(arena);
|
|
659
|
+
return proto_rb;
|
|
660
|
+
}
|
|
661
|
+
|
|
561
662
|
static void FileDescriptor_register(VALUE module) {
|
|
562
663
|
VALUE klass = rb_define_class_under(module, "FileDescriptor", rb_cObject);
|
|
563
664
|
rb_define_alloc_func(klass, FileDescriptor_alloc);
|
|
564
665
|
rb_define_method(klass, "initialize", FileDescriptor_initialize, 3);
|
|
565
666
|
rb_define_method(klass, "name", FileDescriptor_name, 0);
|
|
566
667
|
rb_define_method(klass, "options", FileDescriptor_options, 0);
|
|
668
|
+
rb_define_method(klass, "to_proto", FileDescriptor_to_proto, 0);
|
|
567
669
|
rb_gc_register_address(&cFileDescriptor);
|
|
568
670
|
cFileDescriptor = klass;
|
|
569
671
|
}
|
|
@@ -598,9 +700,15 @@ static FieldDescriptor* ruby_to_FieldDescriptor(VALUE val) {
|
|
|
598
700
|
return ret;
|
|
599
701
|
}
|
|
600
702
|
|
|
703
|
+
/**
|
|
704
|
+
* ruby-doc: FieldDescriptor
|
|
705
|
+
*
|
|
706
|
+
* A FieldDescriptor provides information about the Protobuf definition of a
|
|
707
|
+
* field inside a {Descriptor}.
|
|
708
|
+
*/
|
|
709
|
+
|
|
601
710
|
/*
|
|
602
|
-
*
|
|
603
|
-
* FieldDescriptor.new => field
|
|
711
|
+
* ruby-doc: FieldDescriptor#initialize
|
|
604
712
|
*
|
|
605
713
|
* Returns a new field descriptor. Its name, type, etc. must be set before it is
|
|
606
714
|
* added to a message type.
|
|
@@ -634,10 +742,11 @@ static VALUE FieldDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
634
742
|
}
|
|
635
743
|
|
|
636
744
|
/*
|
|
637
|
-
*
|
|
638
|
-
* FieldDescriptor.name => name
|
|
745
|
+
* ruby-doc: FieldDescriptor#name
|
|
639
746
|
*
|
|
640
747
|
* Returns the name of this field.
|
|
748
|
+
*
|
|
749
|
+
* @return [String]
|
|
641
750
|
*/
|
|
642
751
|
static VALUE FieldDescriptor_name(VALUE _self) {
|
|
643
752
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -702,14 +811,15 @@ static VALUE descriptortype_to_ruby(upb_FieldType type) {
|
|
|
702
811
|
}
|
|
703
812
|
|
|
704
813
|
/*
|
|
705
|
-
*
|
|
706
|
-
* FieldDescriptor.type => type
|
|
814
|
+
* ruby-doc: FieldDescriptor#type
|
|
707
815
|
*
|
|
708
816
|
* Returns this field's type, as a Ruby symbol, or nil if not yet set.
|
|
709
817
|
*
|
|
710
818
|
* Valid field types are:
|
|
711
819
|
* :int32, :int64, :uint32, :uint64, :float, :double, :bool, :string,
|
|
712
820
|
* :bytes, :message.
|
|
821
|
+
*
|
|
822
|
+
* @return [Symbol]
|
|
713
823
|
*/
|
|
714
824
|
static VALUE FieldDescriptor__type(VALUE _self) {
|
|
715
825
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -717,10 +827,11 @@ static VALUE FieldDescriptor__type(VALUE _self) {
|
|
|
717
827
|
}
|
|
718
828
|
|
|
719
829
|
/*
|
|
720
|
-
*
|
|
721
|
-
* FieldDescriptor.default => default
|
|
830
|
+
* ruby-doc: FieldDescriptor#default
|
|
722
831
|
*
|
|
723
832
|
* Returns this field's default, as a Ruby object, or nil if not yet set.
|
|
833
|
+
*
|
|
834
|
+
* @return [Object,nil]
|
|
724
835
|
*/
|
|
725
836
|
static VALUE FieldDescriptor_default(VALUE _self) {
|
|
726
837
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -735,10 +846,11 @@ static VALUE FieldDescriptor_default(VALUE _self) {
|
|
|
735
846
|
}
|
|
736
847
|
|
|
737
848
|
/*
|
|
738
|
-
*
|
|
739
|
-
* FieldDescriptor.has_presence? => bool
|
|
849
|
+
* ruby-doc: FieldDescriptor.has_presence?
|
|
740
850
|
*
|
|
741
851
|
* Returns whether this field tracks presence.
|
|
852
|
+
*
|
|
853
|
+
* @return [Boolean]
|
|
742
854
|
*/
|
|
743
855
|
static VALUE FieldDescriptor_has_presence(VALUE _self) {
|
|
744
856
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -746,10 +858,33 @@ static VALUE FieldDescriptor_has_presence(VALUE _self) {
|
|
|
746
858
|
}
|
|
747
859
|
|
|
748
860
|
/*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
861
|
+
* ruby-doc: FieldDescriptor#required?
|
|
862
|
+
*
|
|
863
|
+
* Returns whether this is a required field.
|
|
864
|
+
*
|
|
865
|
+
* @return [Boolean]
|
|
866
|
+
*/
|
|
867
|
+
static VALUE FieldDescriptor_is_required(VALUE _self) {
|
|
868
|
+
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
869
|
+
return upb_FieldDef_IsRequired(self->fielddef) ? Qtrue : Qfalse;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/*
|
|
873
|
+
* ruby-doc: FieldDescriptor#repeated?
|
|
874
|
+
*
|
|
875
|
+
* Returns whether this is a repeated field.
|
|
876
|
+
* @return [Boolean]
|
|
877
|
+
*/
|
|
878
|
+
static VALUE FieldDescriptor_is_repeated(VALUE _self) {
|
|
879
|
+
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
880
|
+
return upb_FieldDef_IsRepeated(self->fielddef) ? Qtrue : Qfalse;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/*
|
|
884
|
+
* ruby-doc: FieldDescriptor#is_packed?
|
|
751
885
|
*
|
|
752
886
|
* Returns whether this is a repeated field that uses packed encoding.
|
|
887
|
+
* @return [Boolean]
|
|
753
888
|
*/
|
|
754
889
|
static VALUE FieldDescriptor_is_packed(VALUE _self) {
|
|
755
890
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -757,10 +892,11 @@ static VALUE FieldDescriptor_is_packed(VALUE _self) {
|
|
|
757
892
|
}
|
|
758
893
|
|
|
759
894
|
/*
|
|
760
|
-
*
|
|
761
|
-
* FieldDescriptor.json_name => json_name
|
|
895
|
+
* ruby-doc: FieldDescriptor#json_name
|
|
762
896
|
*
|
|
763
897
|
* Returns this field's json_name, as a Ruby string, or nil if not yet set.
|
|
898
|
+
*
|
|
899
|
+
* @return [String,nil]
|
|
764
900
|
*/
|
|
765
901
|
static VALUE FieldDescriptor_json_name(VALUE _self) {
|
|
766
902
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -770,13 +906,14 @@ static VALUE FieldDescriptor_json_name(VALUE _self) {
|
|
|
770
906
|
}
|
|
771
907
|
|
|
772
908
|
/*
|
|
773
|
-
*
|
|
774
|
-
* FieldDescriptor.label => label
|
|
909
|
+
* ruby-doc: FieldDescriptor#label
|
|
775
910
|
*
|
|
776
911
|
* Returns this field's label (i.e., plurality), as a Ruby symbol.
|
|
777
|
-
*
|
|
778
912
|
* Valid field labels are:
|
|
779
|
-
*
|
|
913
|
+
* :optional, :repeated
|
|
914
|
+
*
|
|
915
|
+
* @return [Symbol]
|
|
916
|
+
* @deprecated Use {#repeated?} or {#required?} instead.
|
|
780
917
|
*/
|
|
781
918
|
static VALUE FieldDescriptor_label(VALUE _self) {
|
|
782
919
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -796,10 +933,11 @@ static VALUE FieldDescriptor_label(VALUE _self) {
|
|
|
796
933
|
}
|
|
797
934
|
|
|
798
935
|
/*
|
|
799
|
-
*
|
|
800
|
-
* FieldDescriptor.number => number
|
|
936
|
+
* ruby-doc: FieldDescriptor#number
|
|
801
937
|
*
|
|
802
938
|
* Returns the tag number for this field.
|
|
939
|
+
*
|
|
940
|
+
* @return [Integer]
|
|
803
941
|
*/
|
|
804
942
|
static VALUE FieldDescriptor_number(VALUE _self) {
|
|
805
943
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -807,13 +945,14 @@ static VALUE FieldDescriptor_number(VALUE _self) {
|
|
|
807
945
|
}
|
|
808
946
|
|
|
809
947
|
/*
|
|
810
|
-
*
|
|
811
|
-
* FieldDescriptor.submsg_name => submsg_name
|
|
948
|
+
* ruby-doc: FieldDescriptor#submsg_name
|
|
812
949
|
*
|
|
813
950
|
* Returns the name of the message or enum type corresponding to this field, if
|
|
814
951
|
* it is a message or enum field (respectively), or nil otherwise. This type
|
|
815
952
|
* name will be resolved within the context of the pool to which the containing
|
|
816
953
|
* message type is added.
|
|
954
|
+
*
|
|
955
|
+
* @return [String,nil]
|
|
817
956
|
*/
|
|
818
957
|
static VALUE FieldDescriptor_submsg_name(VALUE _self) {
|
|
819
958
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -830,13 +969,14 @@ static VALUE FieldDescriptor_submsg_name(VALUE _self) {
|
|
|
830
969
|
}
|
|
831
970
|
|
|
832
971
|
/*
|
|
833
|
-
*
|
|
834
|
-
* FieldDescriptor.subtype => message_or_enum_descriptor
|
|
972
|
+
* ruby-doc: FieldDescriptor#subtype
|
|
835
973
|
*
|
|
836
974
|
* Returns the message or enum descriptor corresponding to this field's type if
|
|
837
975
|
* it is a message or enum field, respectively, or nil otherwise. Cannot be
|
|
838
976
|
* called *until* the containing message type is added to a pool (and thus
|
|
839
977
|
* resolved).
|
|
978
|
+
*
|
|
979
|
+
* @return [Descriptor,EnumDescriptor,nil]
|
|
840
980
|
*/
|
|
841
981
|
static VALUE FieldDescriptor_subtype(VALUE _self) {
|
|
842
982
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -853,11 +993,13 @@ static VALUE FieldDescriptor_subtype(VALUE _self) {
|
|
|
853
993
|
}
|
|
854
994
|
|
|
855
995
|
/*
|
|
856
|
-
*
|
|
857
|
-
* FieldDescriptor.get(message) => value
|
|
996
|
+
* ruby-doc: FieldDescriptor#get
|
|
858
997
|
*
|
|
859
998
|
* Returns the value set for this field on the given message. Raises an
|
|
860
999
|
* exception if message is of the wrong type.
|
|
1000
|
+
*
|
|
1001
|
+
* @param message [AbstractMessage]
|
|
1002
|
+
* @return [Object]
|
|
861
1003
|
*/
|
|
862
1004
|
static VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb) {
|
|
863
1005
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -873,11 +1015,13 @@ static VALUE FieldDescriptor_get(VALUE _self, VALUE msg_rb) {
|
|
|
873
1015
|
}
|
|
874
1016
|
|
|
875
1017
|
/*
|
|
876
|
-
*
|
|
877
|
-
* FieldDescriptor.has?(message) => boolean
|
|
1018
|
+
* ruby-doc: FieldDescriptor.has?
|
|
878
1019
|
*
|
|
879
1020
|
* Returns whether the value is set on the given message. Raises an
|
|
880
1021
|
* exception when calling for fields that do not have presence.
|
|
1022
|
+
*
|
|
1023
|
+
* @param message [AbstractMessage]
|
|
1024
|
+
* @return [Boolean]
|
|
881
1025
|
*/
|
|
882
1026
|
static VALUE FieldDescriptor_has(VALUE _self, VALUE msg_rb) {
|
|
883
1027
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -894,10 +1038,12 @@ static VALUE FieldDescriptor_has(VALUE _self, VALUE msg_rb) {
|
|
|
894
1038
|
}
|
|
895
1039
|
|
|
896
1040
|
/*
|
|
897
|
-
*
|
|
898
|
-
* FieldDescriptor.clear(message)
|
|
1041
|
+
* ruby-doc: FieldDescriptor#clear
|
|
899
1042
|
*
|
|
900
1043
|
* Clears the field from the message if it's set.
|
|
1044
|
+
*
|
|
1045
|
+
* @param message [AbstractMessage]
|
|
1046
|
+
* @return [nil]
|
|
901
1047
|
*/
|
|
902
1048
|
static VALUE FieldDescriptor_clear(VALUE _self, VALUE msg_rb) {
|
|
903
1049
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -913,12 +1059,14 @@ static VALUE FieldDescriptor_clear(VALUE _self, VALUE msg_rb) {
|
|
|
913
1059
|
}
|
|
914
1060
|
|
|
915
1061
|
/*
|
|
916
|
-
*
|
|
917
|
-
* FieldDescriptor.set(message, value)
|
|
1062
|
+
* ruby-doc: FieldDescriptor#set
|
|
918
1063
|
*
|
|
919
1064
|
* Sets the value corresponding to this field to the given value on the given
|
|
920
1065
|
* message. Raises an exception if message is of the wrong type. Performs the
|
|
921
1066
|
* ordinary type-checks for field setting.
|
|
1067
|
+
*
|
|
1068
|
+
* @param message [AbstractMessage]
|
|
1069
|
+
* @param value [Object]
|
|
922
1070
|
*/
|
|
923
1071
|
static VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value) {
|
|
924
1072
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -938,10 +1086,13 @@ static VALUE FieldDescriptor_set(VALUE _self, VALUE msg_rb, VALUE value) {
|
|
|
938
1086
|
}
|
|
939
1087
|
|
|
940
1088
|
/*
|
|
941
|
-
*
|
|
942
|
-
*
|
|
1089
|
+
* ruby-doc: FieldDescriptor#options
|
|
1090
|
+
*
|
|
1091
|
+
* Returns the
|
|
1092
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L656
|
|
1093
|
+
* FieldOptions} for this {FieldDescriptor}.
|
|
943
1094
|
*
|
|
944
|
-
*
|
|
1095
|
+
* @return [FieldOptions]
|
|
945
1096
|
*/
|
|
946
1097
|
static VALUE FieldDescriptor_options(VALUE _self) {
|
|
947
1098
|
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
@@ -956,6 +1107,30 @@ static VALUE FieldDescriptor_options(VALUE _self) {
|
|
|
956
1107
|
return field_options;
|
|
957
1108
|
}
|
|
958
1109
|
|
|
1110
|
+
/*
|
|
1111
|
+
* ruby-doc: FieldDescriptor#to_proto
|
|
1112
|
+
*
|
|
1113
|
+
* Returns the
|
|
1114
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L236
|
|
1115
|
+
* FieldDescriptorProto} of this {FieldDescriptor}.
|
|
1116
|
+
*
|
|
1117
|
+
* @return [FieldDescriptorProto]
|
|
1118
|
+
*/
|
|
1119
|
+
static VALUE FieldDescriptor_to_proto(VALUE _self) {
|
|
1120
|
+
FieldDescriptor* self = ruby_to_FieldDescriptor(_self);
|
|
1121
|
+
upb_Arena* arena = upb_Arena_New();
|
|
1122
|
+
google_protobuf_FieldDescriptorProto* proto =
|
|
1123
|
+
upb_FieldDef_ToProto(self->fielddef, arena);
|
|
1124
|
+
size_t size;
|
|
1125
|
+
const char* serialized =
|
|
1126
|
+
google_protobuf_FieldDescriptorProto_serialize(proto, arena, &size);
|
|
1127
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::FieldDescriptorProto");
|
|
1128
|
+
VALUE proto_rb =
|
|
1129
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
1130
|
+
upb_Arena_Free(arena);
|
|
1131
|
+
return proto_rb;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
959
1134
|
static void FieldDescriptor_register(VALUE module) {
|
|
960
1135
|
VALUE klass = rb_define_class_under(module, "FieldDescriptor", rb_cObject);
|
|
961
1136
|
rb_define_alloc_func(klass, FieldDescriptor_alloc);
|
|
@@ -964,6 +1139,8 @@ static void FieldDescriptor_register(VALUE module) {
|
|
|
964
1139
|
rb_define_method(klass, "type", FieldDescriptor__type, 0);
|
|
965
1140
|
rb_define_method(klass, "default", FieldDescriptor_default, 0);
|
|
966
1141
|
rb_define_method(klass, "has_presence?", FieldDescriptor_has_presence, 0);
|
|
1142
|
+
rb_define_method(klass, "required?", FieldDescriptor_is_required, 0);
|
|
1143
|
+
rb_define_method(klass, "repeated?", FieldDescriptor_is_repeated, 0);
|
|
967
1144
|
rb_define_method(klass, "is_packed?", FieldDescriptor_is_packed, 0);
|
|
968
1145
|
rb_define_method(klass, "json_name", FieldDescriptor_json_name, 0);
|
|
969
1146
|
rb_define_method(klass, "label", FieldDescriptor_label, 0);
|
|
@@ -975,6 +1152,7 @@ static void FieldDescriptor_register(VALUE module) {
|
|
|
975
1152
|
rb_define_method(klass, "get", FieldDescriptor_get, 1);
|
|
976
1153
|
rb_define_method(klass, "set", FieldDescriptor_set, 2);
|
|
977
1154
|
rb_define_method(klass, "options", FieldDescriptor_options, 0);
|
|
1155
|
+
rb_define_method(klass, "to_proto", FieldDescriptor_to_proto, 0);
|
|
978
1156
|
rb_gc_register_address(&cFieldDescriptor);
|
|
979
1157
|
cFieldDescriptor = klass;
|
|
980
1158
|
}
|
|
@@ -1009,9 +1187,15 @@ static OneofDescriptor* ruby_to_OneofDescriptor(VALUE val) {
|
|
|
1009
1187
|
return ret;
|
|
1010
1188
|
}
|
|
1011
1189
|
|
|
1190
|
+
/**
|
|
1191
|
+
* ruby-doc: OneofDescriptor
|
|
1192
|
+
*
|
|
1193
|
+
* A OneofDescriptor provides information about the Protobuf definition of a
|
|
1194
|
+
* oneof inside a {Descriptor}.
|
|
1195
|
+
*/
|
|
1196
|
+
|
|
1012
1197
|
/*
|
|
1013
|
-
*
|
|
1014
|
-
* OneofDescriptor.new => oneof_descriptor
|
|
1198
|
+
* ruby-doc: OneofDescriptor#initialize
|
|
1015
1199
|
*
|
|
1016
1200
|
* Creates a new, empty, oneof descriptor. The oneof may only be modified prior
|
|
1017
1201
|
* to being added to a message descriptor which is subsequently added to a pool.
|
|
@@ -1046,10 +1230,11 @@ static VALUE OneofDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
1046
1230
|
}
|
|
1047
1231
|
|
|
1048
1232
|
/*
|
|
1049
|
-
*
|
|
1050
|
-
* OneofDescriptor.name => name
|
|
1233
|
+
* ruby-doc: OneofDescriptor#name
|
|
1051
1234
|
*
|
|
1052
1235
|
* Returns the name of this oneof.
|
|
1236
|
+
*
|
|
1237
|
+
* @return [String]
|
|
1053
1238
|
*/
|
|
1054
1239
|
static VALUE OneofDescriptor_name(VALUE _self) {
|
|
1055
1240
|
OneofDescriptor* self = ruby_to_OneofDescriptor(_self);
|
|
@@ -1057,10 +1242,12 @@ static VALUE OneofDescriptor_name(VALUE _self) {
|
|
|
1057
1242
|
}
|
|
1058
1243
|
|
|
1059
1244
|
/*
|
|
1060
|
-
*
|
|
1061
|
-
* OneofDescriptor.each(&block) => nil
|
|
1245
|
+
* ruby-doc: OneofDescriptor#each
|
|
1062
1246
|
*
|
|
1063
1247
|
* Iterates through fields in this oneof, yielding to the block on each one.
|
|
1248
|
+
*
|
|
1249
|
+
* @yield [FieldDescriptor]
|
|
1250
|
+
* @return [nil]
|
|
1064
1251
|
*/
|
|
1065
1252
|
static VALUE OneofDescriptor_each(VALUE _self) {
|
|
1066
1253
|
OneofDescriptor* self = ruby_to_OneofDescriptor(_self);
|
|
@@ -1075,10 +1262,13 @@ static VALUE OneofDescriptor_each(VALUE _self) {
|
|
|
1075
1262
|
}
|
|
1076
1263
|
|
|
1077
1264
|
/*
|
|
1078
|
-
*
|
|
1079
|
-
* OneofDescriptor.options => options
|
|
1265
|
+
* ruby-doc: OneofDescriptor#options
|
|
1080
1266
|
*
|
|
1081
|
-
* Returns the
|
|
1267
|
+
* Returns the
|
|
1268
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L824
|
|
1269
|
+
* OneofOptions} for this {OneofDescriptor}.
|
|
1270
|
+
*
|
|
1271
|
+
* @return [OneofOptions]
|
|
1082
1272
|
*/
|
|
1083
1273
|
static VALUE OneOfDescriptor_options(VALUE _self) {
|
|
1084
1274
|
OneofDescriptor* self = ruby_to_OneofDescriptor(_self);
|
|
@@ -1093,6 +1283,30 @@ static VALUE OneOfDescriptor_options(VALUE _self) {
|
|
|
1093
1283
|
return oneof_options;
|
|
1094
1284
|
}
|
|
1095
1285
|
|
|
1286
|
+
/*
|
|
1287
|
+
* ruby-doc: OneofDescriptor#to_proto
|
|
1288
|
+
*
|
|
1289
|
+
* Returns the
|
|
1290
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L343
|
|
1291
|
+
* OneofDescriptorProto} of this {OneofDescriptor}.
|
|
1292
|
+
*
|
|
1293
|
+
* @return [OneofDescriptorProto]
|
|
1294
|
+
*/
|
|
1295
|
+
static VALUE OneOfDescriptor_to_proto(VALUE _self) {
|
|
1296
|
+
OneofDescriptor* self = ruby_to_OneofDescriptor(_self);
|
|
1297
|
+
upb_Arena* arena = upb_Arena_New();
|
|
1298
|
+
google_protobuf_OneofDescriptorProto* proto =
|
|
1299
|
+
upb_OneofDef_ToProto(self->oneofdef, arena);
|
|
1300
|
+
size_t size;
|
|
1301
|
+
const char* serialized =
|
|
1302
|
+
google_protobuf_OneofDescriptorProto_serialize(proto, arena, &size);
|
|
1303
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::OneofDescriptorProto");
|
|
1304
|
+
VALUE proto_rb =
|
|
1305
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
1306
|
+
upb_Arena_Free(arena);
|
|
1307
|
+
return proto_rb;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1096
1310
|
static void OneofDescriptor_register(VALUE module) {
|
|
1097
1311
|
VALUE klass = rb_define_class_under(module, "OneofDescriptor", rb_cObject);
|
|
1098
1312
|
rb_define_alloc_func(klass, OneofDescriptor_alloc);
|
|
@@ -1100,6 +1314,7 @@ static void OneofDescriptor_register(VALUE module) {
|
|
|
1100
1314
|
rb_define_method(klass, "name", OneofDescriptor_name, 0);
|
|
1101
1315
|
rb_define_method(klass, "each", OneofDescriptor_each, 0);
|
|
1102
1316
|
rb_define_method(klass, "options", OneOfDescriptor_options, 0);
|
|
1317
|
+
rb_define_method(klass, "to_proto", OneOfDescriptor_to_proto, 0);
|
|
1103
1318
|
rb_include_module(klass, rb_mEnumerable);
|
|
1104
1319
|
rb_gc_register_address(&cOneofDescriptor);
|
|
1105
1320
|
cOneofDescriptor = klass;
|
|
@@ -1152,6 +1367,13 @@ const upb_EnumDef* EnumDescriptor_GetEnumDef(VALUE enum_desc_rb) {
|
|
|
1152
1367
|
return desc->enumdef;
|
|
1153
1368
|
}
|
|
1154
1369
|
|
|
1370
|
+
/**
|
|
1371
|
+
* ruby-doc: EnumDescriptor
|
|
1372
|
+
*
|
|
1373
|
+
* An EnumDescriptor provides information about the Protobuf definition of an
|
|
1374
|
+
* enum inside a {Descriptor}.
|
|
1375
|
+
*/
|
|
1376
|
+
|
|
1155
1377
|
/*
|
|
1156
1378
|
* call-seq:
|
|
1157
1379
|
* EnumDescriptor.new(c_only_cookie, ptr) => EnumDescriptor
|
|
@@ -1174,10 +1396,11 @@ static VALUE EnumDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
1174
1396
|
}
|
|
1175
1397
|
|
|
1176
1398
|
/*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1399
|
+
* ruby-doc: EnumDescriptor#file_descriptor
|
|
1400
|
+
*
|
|
1401
|
+
* Returns the {FileDescriptor} object this enum belongs to.
|
|
1179
1402
|
*
|
|
1180
|
-
*
|
|
1403
|
+
* @return [FileDescriptor]
|
|
1181
1404
|
*/
|
|
1182
1405
|
static VALUE EnumDescriptor_file_descriptor(VALUE _self) {
|
|
1183
1406
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1186,10 +1409,11 @@ static VALUE EnumDescriptor_file_descriptor(VALUE _self) {
|
|
|
1186
1409
|
}
|
|
1187
1410
|
|
|
1188
1411
|
/*
|
|
1189
|
-
*
|
|
1190
|
-
* EnumDescriptor.is_closed? => bool
|
|
1412
|
+
* ruby-doc: EnumDescriptor#is_closed?
|
|
1191
1413
|
*
|
|
1192
1414
|
* Returns whether this enum is open or closed.
|
|
1415
|
+
*
|
|
1416
|
+
* @return [Boolean]
|
|
1193
1417
|
*/
|
|
1194
1418
|
static VALUE EnumDescriptor_is_closed(VALUE _self) {
|
|
1195
1419
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1197,10 +1421,11 @@ static VALUE EnumDescriptor_is_closed(VALUE _self) {
|
|
|
1197
1421
|
}
|
|
1198
1422
|
|
|
1199
1423
|
/*
|
|
1200
|
-
*
|
|
1201
|
-
* EnumDescriptor.name => name
|
|
1424
|
+
* ruby-doc: EnumDescriptor#name
|
|
1202
1425
|
*
|
|
1203
1426
|
* Returns the name of this enum type.
|
|
1427
|
+
*
|
|
1428
|
+
* @return [String]
|
|
1204
1429
|
*/
|
|
1205
1430
|
static VALUE EnumDescriptor_name(VALUE _self) {
|
|
1206
1431
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1208,11 +1433,13 @@ static VALUE EnumDescriptor_name(VALUE _self) {
|
|
|
1208
1433
|
}
|
|
1209
1434
|
|
|
1210
1435
|
/*
|
|
1211
|
-
*
|
|
1212
|
-
* EnumDescriptor.lookup_name(name) => value
|
|
1436
|
+
* ruby-doc: EnumDescriptor#lookup_name
|
|
1213
1437
|
*
|
|
1214
1438
|
* Returns the numeric value corresponding to the given key name (as a Ruby
|
|
1215
1439
|
* symbol), or nil if none.
|
|
1440
|
+
*
|
|
1441
|
+
* @param name [Symbol]
|
|
1442
|
+
* @return [Integer,nil]
|
|
1216
1443
|
*/
|
|
1217
1444
|
static VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name) {
|
|
1218
1445
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1227,11 +1454,13 @@ static VALUE EnumDescriptor_lookup_name(VALUE _self, VALUE name) {
|
|
|
1227
1454
|
}
|
|
1228
1455
|
|
|
1229
1456
|
/*
|
|
1230
|
-
*
|
|
1231
|
-
* EnumDescriptor.lookup_value(name) => value
|
|
1457
|
+
* ruby-doc: EnumDescriptor#lookup_value
|
|
1232
1458
|
*
|
|
1233
1459
|
* Returns the key name (as a Ruby symbol) corresponding to the integer value,
|
|
1234
1460
|
* or nil if none.
|
|
1461
|
+
*
|
|
1462
|
+
* @param name [Integer]
|
|
1463
|
+
* @return [Symbol,nil]
|
|
1235
1464
|
*/
|
|
1236
1465
|
static VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number) {
|
|
1237
1466
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1246,11 +1475,13 @@ static VALUE EnumDescriptor_lookup_value(VALUE _self, VALUE number) {
|
|
|
1246
1475
|
}
|
|
1247
1476
|
|
|
1248
1477
|
/*
|
|
1249
|
-
*
|
|
1250
|
-
* EnumDescriptor.each(&block)
|
|
1478
|
+
* ruby-doc: EnumDescriptor#each
|
|
1251
1479
|
*
|
|
1252
1480
|
* Iterates over key => value mappings in this enum's definition, yielding to
|
|
1253
1481
|
* the block with (key, value) arguments for each one.
|
|
1482
|
+
*
|
|
1483
|
+
* @yield [Symbol, Integer]
|
|
1484
|
+
* @return [nil]
|
|
1254
1485
|
*/
|
|
1255
1486
|
static VALUE EnumDescriptor_each(VALUE _self) {
|
|
1256
1487
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1267,10 +1498,11 @@ static VALUE EnumDescriptor_each(VALUE _self) {
|
|
|
1267
1498
|
}
|
|
1268
1499
|
|
|
1269
1500
|
/*
|
|
1270
|
-
*
|
|
1271
|
-
* EnumDescriptor.enummodule => module
|
|
1501
|
+
* ruby-doc: EnumDescriptor#enummodule
|
|
1272
1502
|
*
|
|
1273
1503
|
* Returns the Ruby module corresponding to this enum type.
|
|
1504
|
+
*
|
|
1505
|
+
* @return [Module]
|
|
1274
1506
|
*/
|
|
1275
1507
|
static VALUE EnumDescriptor_enummodule(VALUE _self) {
|
|
1276
1508
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1281,10 +1513,13 @@ static VALUE EnumDescriptor_enummodule(VALUE _self) {
|
|
|
1281
1513
|
}
|
|
1282
1514
|
|
|
1283
1515
|
/*
|
|
1284
|
-
*
|
|
1285
|
-
* EnumDescriptor.options => options
|
|
1516
|
+
* ruby-doc: EnumDescriptor#options
|
|
1286
1517
|
*
|
|
1287
|
-
* Returns the
|
|
1518
|
+
* Returns the
|
|
1519
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L838
|
|
1520
|
+
* EnumOptions} for this {EnumDescriptor}.
|
|
1521
|
+
*
|
|
1522
|
+
* @return [EnumOptions]
|
|
1288
1523
|
*/
|
|
1289
1524
|
static VALUE EnumDescriptor_options(VALUE _self) {
|
|
1290
1525
|
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
@@ -1298,6 +1533,31 @@ static VALUE EnumDescriptor_options(VALUE _self) {
|
|
|
1298
1533
|
return enum_options;
|
|
1299
1534
|
}
|
|
1300
1535
|
|
|
1536
|
+
/*
|
|
1537
|
+
* ruby-doc: EnumDescriptor#to_proto
|
|
1538
|
+
*
|
|
1539
|
+
* Returns the
|
|
1540
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L349
|
|
1541
|
+
* EnumDescriptorProto} of this {EnumDescriptor}.
|
|
1542
|
+
* @return [EnumDescriptorProto]
|
|
1543
|
+
*/
|
|
1544
|
+
static VALUE EnumDescriptor_to_proto(VALUE _self) {
|
|
1545
|
+
EnumDescriptor* self = ruby_to_EnumDescriptor(_self);
|
|
1546
|
+
upb_Arena* arena = upb_Arena_New();
|
|
1547
|
+
google_protobuf_EnumDescriptorProto* proto =
|
|
1548
|
+
upb_EnumDef_ToProto(self->enumdef, arena);
|
|
1549
|
+
|
|
1550
|
+
size_t size;
|
|
1551
|
+
const char* serialized =
|
|
1552
|
+
google_protobuf_EnumDescriptorProto_serialize(proto, arena, &size);
|
|
1553
|
+
|
|
1554
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::EnumDescriptorProto");
|
|
1555
|
+
VALUE proto_rb =
|
|
1556
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
1557
|
+
upb_Arena_Free(arena);
|
|
1558
|
+
return proto_rb;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1301
1561
|
static void EnumDescriptor_register(VALUE module) {
|
|
1302
1562
|
VALUE klass = rb_define_class_under(module, "EnumDescriptor", rb_cObject);
|
|
1303
1563
|
rb_define_alloc_func(klass, EnumDescriptor_alloc);
|
|
@@ -1310,6 +1570,7 @@ static void EnumDescriptor_register(VALUE module) {
|
|
|
1310
1570
|
rb_define_method(klass, "file_descriptor", EnumDescriptor_file_descriptor, 0);
|
|
1311
1571
|
rb_define_method(klass, "is_closed?", EnumDescriptor_is_closed, 0);
|
|
1312
1572
|
rb_define_method(klass, "options", EnumDescriptor_options, 0);
|
|
1573
|
+
rb_define_method(klass, "to_proto", EnumDescriptor_to_proto, 0);
|
|
1313
1574
|
rb_include_module(klass, rb_mEnumerable);
|
|
1314
1575
|
rb_gc_register_address(&cEnumDescriptor);
|
|
1315
1576
|
cEnumDescriptor = klass;
|
|
@@ -1356,6 +1617,13 @@ static VALUE ServiceDescriptor_alloc(VALUE klass) {
|
|
|
1356
1617
|
return ret;
|
|
1357
1618
|
}
|
|
1358
1619
|
|
|
1620
|
+
/**
|
|
1621
|
+
* ruby-doc: ServiceDescriptor
|
|
1622
|
+
*
|
|
1623
|
+
* A ServiceDescriptor provides information about the Protobuf definition of an
|
|
1624
|
+
* RPC service.
|
|
1625
|
+
*/
|
|
1626
|
+
|
|
1359
1627
|
/*
|
|
1360
1628
|
* call-seq:
|
|
1361
1629
|
* ServiceDescriptor.new(c_only_cookie, ptr) => ServiceDescriptor
|
|
@@ -1378,10 +1646,11 @@ static VALUE ServiceDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
1378
1646
|
}
|
|
1379
1647
|
|
|
1380
1648
|
/*
|
|
1381
|
-
*
|
|
1382
|
-
* ServiceDescriptor.name => name
|
|
1649
|
+
* ruby-doc: ServiceDescriptor#name
|
|
1383
1650
|
*
|
|
1384
1651
|
* Returns the name of this service.
|
|
1652
|
+
*
|
|
1653
|
+
* @return [String]
|
|
1385
1654
|
*/
|
|
1386
1655
|
static VALUE ServiceDescriptor_name(VALUE _self) {
|
|
1387
1656
|
ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
|
|
@@ -1389,10 +1658,10 @@ static VALUE ServiceDescriptor_name(VALUE _self) {
|
|
|
1389
1658
|
}
|
|
1390
1659
|
|
|
1391
1660
|
/*
|
|
1392
|
-
*
|
|
1393
|
-
* ServiceDescriptor.file_descriptor
|
|
1661
|
+
* ruby-doc: ServiceDescriptor#file_descriptor
|
|
1394
1662
|
*
|
|
1395
|
-
* Returns the FileDescriptor object this service belongs to.
|
|
1663
|
+
* Returns the {FileDescriptor} object this service belongs to.
|
|
1664
|
+
* @return [FileDescriptor]
|
|
1396
1665
|
*/
|
|
1397
1666
|
static VALUE ServiceDescriptor_file_descriptor(VALUE _self) {
|
|
1398
1667
|
ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
|
|
@@ -1401,10 +1670,12 @@ static VALUE ServiceDescriptor_file_descriptor(VALUE _self) {
|
|
|
1401
1670
|
}
|
|
1402
1671
|
|
|
1403
1672
|
/*
|
|
1404
|
-
*
|
|
1405
|
-
* ServiceDescriptor.each(&block)
|
|
1673
|
+
* ruby-doc: ServiceDescriptor#each
|
|
1406
1674
|
*
|
|
1407
1675
|
* Iterates over methods in this service, yielding to the block on each one.
|
|
1676
|
+
*
|
|
1677
|
+
* @yield [MethodDescriptor]
|
|
1678
|
+
* @return [nil]
|
|
1408
1679
|
*/
|
|
1409
1680
|
static VALUE ServiceDescriptor_each(VALUE _self) {
|
|
1410
1681
|
ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
|
|
@@ -1419,10 +1690,13 @@ static VALUE ServiceDescriptor_each(VALUE _self) {
|
|
|
1419
1690
|
}
|
|
1420
1691
|
|
|
1421
1692
|
/*
|
|
1422
|
-
*
|
|
1423
|
-
* ServiceDescriptor.options => options
|
|
1693
|
+
* ruby-doc: ServiceDescriptor#options
|
|
1424
1694
|
*
|
|
1425
|
-
* Returns the
|
|
1695
|
+
* Returns the
|
|
1696
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L901
|
|
1697
|
+
* ServiceOptions} for this {ServiceDescriptor}.
|
|
1698
|
+
*
|
|
1699
|
+
* @return [ServiceOptions]
|
|
1426
1700
|
*/
|
|
1427
1701
|
static VALUE ServiceDescriptor_options(VALUE _self) {
|
|
1428
1702
|
ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
|
|
@@ -1438,6 +1712,30 @@ static VALUE ServiceDescriptor_options(VALUE _self) {
|
|
|
1438
1712
|
return service_options;
|
|
1439
1713
|
}
|
|
1440
1714
|
|
|
1715
|
+
/*
|
|
1716
|
+
* ruby-doc: ServiceDescriptor#to_proto
|
|
1717
|
+
*
|
|
1718
|
+
* Returns the
|
|
1719
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L386
|
|
1720
|
+
* ServiceDescriptorProto} of this {ServiceDescriptor}.
|
|
1721
|
+
*
|
|
1722
|
+
* @return [ServiceDescriptorProto]
|
|
1723
|
+
*/
|
|
1724
|
+
static VALUE ServiceDescriptor_to_proto(VALUE _self) {
|
|
1725
|
+
ServiceDescriptor* self = ruby_to_ServiceDescriptor(_self);
|
|
1726
|
+
upb_Arena* arena = upb_Arena_New();
|
|
1727
|
+
google_protobuf_ServiceDescriptorProto* proto =
|
|
1728
|
+
upb_ServiceDef_ToProto(self->servicedef, arena);
|
|
1729
|
+
size_t size;
|
|
1730
|
+
const char* serialized =
|
|
1731
|
+
google_protobuf_ServiceDescriptorProto_serialize(proto, arena, &size);
|
|
1732
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::ServiceDescriptorProto");
|
|
1733
|
+
VALUE proto_rb =
|
|
1734
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
1735
|
+
upb_Arena_Free(arena);
|
|
1736
|
+
return proto_rb;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1441
1739
|
static void ServiceDescriptor_register(VALUE module) {
|
|
1442
1740
|
VALUE klass = rb_define_class_under(module, "ServiceDescriptor", rb_cObject);
|
|
1443
1741
|
rb_define_alloc_func(klass, ServiceDescriptor_alloc);
|
|
@@ -1447,6 +1745,7 @@ static void ServiceDescriptor_register(VALUE module) {
|
|
|
1447
1745
|
rb_define_method(klass, "file_descriptor", ServiceDescriptor_file_descriptor,
|
|
1448
1746
|
0);
|
|
1449
1747
|
rb_define_method(klass, "options", ServiceDescriptor_options, 0);
|
|
1748
|
+
rb_define_method(klass, "to_proto", ServiceDescriptor_to_proto, 0);
|
|
1450
1749
|
rb_include_module(klass, rb_mEnumerable);
|
|
1451
1750
|
rb_gc_register_address(&cServiceDescriptor);
|
|
1452
1751
|
cServiceDescriptor = klass;
|
|
@@ -1493,6 +1792,13 @@ static VALUE MethodDescriptor_alloc(VALUE klass) {
|
|
|
1493
1792
|
return ret;
|
|
1494
1793
|
}
|
|
1495
1794
|
|
|
1795
|
+
/**
|
|
1796
|
+
* ruby-doc: MethodDescriptor
|
|
1797
|
+
*
|
|
1798
|
+
* A MethodDescriptor provides information about the Protobuf definition of a
|
|
1799
|
+
* method inside an RPC service.
|
|
1800
|
+
*/
|
|
1801
|
+
|
|
1496
1802
|
/*
|
|
1497
1803
|
* call-seq:
|
|
1498
1804
|
* MethodDescriptor.new(c_only_cookie, ptr) => MethodDescriptor
|
|
@@ -1515,10 +1821,11 @@ static VALUE MethodDescriptor_initialize(VALUE _self, VALUE cookie,
|
|
|
1515
1821
|
}
|
|
1516
1822
|
|
|
1517
1823
|
/*
|
|
1518
|
-
*
|
|
1519
|
-
* MethodDescriptor.name => name
|
|
1824
|
+
* ruby-doc: MethodDescriptor#name
|
|
1520
1825
|
*
|
|
1521
1826
|
* Returns the name of this method
|
|
1827
|
+
*
|
|
1828
|
+
* @return [String]
|
|
1522
1829
|
*/
|
|
1523
1830
|
static VALUE MethodDescriptor_name(VALUE _self) {
|
|
1524
1831
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1526,10 +1833,13 @@ static VALUE MethodDescriptor_name(VALUE _self) {
|
|
|
1526
1833
|
}
|
|
1527
1834
|
|
|
1528
1835
|
/*
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1836
|
+
* ruby-doc: MethodDescriptor#options
|
|
1837
|
+
*
|
|
1838
|
+
* Returns the
|
|
1839
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L927
|
|
1840
|
+
* MethodOptions} for this {MethodDescriptor}.
|
|
1531
1841
|
*
|
|
1532
|
-
*
|
|
1842
|
+
* @return [MethodOptions]
|
|
1533
1843
|
*/
|
|
1534
1844
|
static VALUE MethodDescriptor_options(VALUE _self) {
|
|
1535
1845
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1546,10 +1856,11 @@ static VALUE MethodDescriptor_options(VALUE _self) {
|
|
|
1546
1856
|
}
|
|
1547
1857
|
|
|
1548
1858
|
/*
|
|
1549
|
-
*
|
|
1550
|
-
*
|
|
1859
|
+
* ruby-doc: MethodDescriptor#input_type
|
|
1860
|
+
*
|
|
1861
|
+
* Returns the {Descriptor} for the request message type of this method
|
|
1551
1862
|
*
|
|
1552
|
-
*
|
|
1863
|
+
* @return [Descriptor]
|
|
1553
1864
|
*/
|
|
1554
1865
|
static VALUE MethodDescriptor_input_type(VALUE _self) {
|
|
1555
1866
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1558,10 +1869,11 @@ static VALUE MethodDescriptor_input_type(VALUE _self) {
|
|
|
1558
1869
|
}
|
|
1559
1870
|
|
|
1560
1871
|
/*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1872
|
+
* ruby-doc: MethodDescriptor#output_type
|
|
1873
|
+
*
|
|
1874
|
+
* Returns the {Descriptor} for the response message type of this method
|
|
1563
1875
|
*
|
|
1564
|
-
*
|
|
1876
|
+
* @return [Descriptor]
|
|
1565
1877
|
*/
|
|
1566
1878
|
static VALUE MethodDescriptor_output_type(VALUE _self) {
|
|
1567
1879
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1570,10 +1882,11 @@ static VALUE MethodDescriptor_output_type(VALUE _self) {
|
|
|
1570
1882
|
}
|
|
1571
1883
|
|
|
1572
1884
|
/*
|
|
1573
|
-
*
|
|
1574
|
-
* MethodDescriptor.client_streaming => bool
|
|
1885
|
+
* ruby-doc: MethodDescriptor#client_streaming
|
|
1575
1886
|
*
|
|
1576
1887
|
* Returns whether or not this is a streaming request method
|
|
1888
|
+
*
|
|
1889
|
+
* @return [Boolean]
|
|
1577
1890
|
*/
|
|
1578
1891
|
static VALUE MethodDescriptor_client_streaming(VALUE _self) {
|
|
1579
1892
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1581,10 +1894,35 @@ static VALUE MethodDescriptor_client_streaming(VALUE _self) {
|
|
|
1581
1894
|
}
|
|
1582
1895
|
|
|
1583
1896
|
/*
|
|
1584
|
-
*
|
|
1585
|
-
*
|
|
1897
|
+
* ruby-doc: MethodDescriptor#to_proto
|
|
1898
|
+
*
|
|
1899
|
+
* Returns the
|
|
1900
|
+
* {https://github.com/protocolbuffers/protobuf/blob/v30.2/src/google/protobuf/descriptor.proto#L394
|
|
1901
|
+
* MethodDescriptorProto} of this {MethodDescriptor}.
|
|
1902
|
+
*
|
|
1903
|
+
* @return [MethodDescriptorProto]
|
|
1904
|
+
*/
|
|
1905
|
+
static VALUE MethodDescriptor_to_proto(VALUE _self) {
|
|
1906
|
+
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
1907
|
+
upb_Arena* arena = upb_Arena_New();
|
|
1908
|
+
google_protobuf_MethodDescriptorProto* proto =
|
|
1909
|
+
upb_MethodDef_ToProto(self->methoddef, arena);
|
|
1910
|
+
size_t size;
|
|
1911
|
+
const char* serialized =
|
|
1912
|
+
google_protobuf_MethodDescriptorProto_serialize(proto, arena, &size);
|
|
1913
|
+
VALUE proto_class = rb_path2class("Google::Protobuf::MethodDescriptorProto");
|
|
1914
|
+
VALUE proto_rb =
|
|
1915
|
+
Message_decode_bytes(size, serialized, 0, proto_class, false);
|
|
1916
|
+
upb_Arena_Free(arena);
|
|
1917
|
+
return proto_rb;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/*
|
|
1921
|
+
* ruby-doc: MethodDescriptor#server_streaming
|
|
1586
1922
|
*
|
|
1587
1923
|
* Returns whether or not this is a streaming response method
|
|
1924
|
+
*
|
|
1925
|
+
* @return [Boolean]
|
|
1588
1926
|
*/
|
|
1589
1927
|
static VALUE MethodDescriptor_server_streaming(VALUE _self) {
|
|
1590
1928
|
MethodDescriptor* self = ruby_to_MethodDescriptor(_self);
|
|
@@ -1603,6 +1941,7 @@ static void MethodDescriptor_register(VALUE module) {
|
|
|
1603
1941
|
0);
|
|
1604
1942
|
rb_define_method(klass, "server_streaming", MethodDescriptor_server_streaming,
|
|
1605
1943
|
0);
|
|
1944
|
+
rb_define_method(klass, "to_proto", MethodDescriptor_to_proto, 0);
|
|
1606
1945
|
rb_gc_register_address(&cMethodDescriptor);
|
|
1607
1946
|
cMethodDescriptor = klass;
|
|
1608
1947
|
}
|