module Proto::HasUnknownFields

Overview

Mixin that adds unknown field capture and re-serialization to a message class.

Include this module inside any class that inherits Proto::Message to get: capture_unknown_field(reader, field_number, wire_type) write_unknown_fields(writer)

Direct including types

Defined in:

proto/unknown_field.cr

Instance Method Summary

Instance Method Detail

def add_unknown_varint(field_number : Int32, value : UInt64) : Nil #

Append a raw unknown varint value when a field cannot be decoded semantically (for example, unknown enum numeric values under strict enum APIs).


[View source]
def capture_unknown_field(reader : Wire::Reader, field_number : Int32, wire_type : Int32) : Nil #

[View source]
def capture_unknown_field(field : UnknownField) : Nil #

[View source]
def decode_known_enum(field_number : Int32, raw_u64 : UInt64, & : Int32 -> ) : Nil #

[View source]
def extension_value?(descriptor : T) : ExtensionValue | Nil forall T #

Returns the last matching extension value (proto singular semantics) or nil.


[View source]
def extension_values(descriptor : T) : Array(ExtensionValue) forall T #

Returns all matching extension values in wire order.


[View source]
def has_extension?(descriptor : T) : Bool forall T #

Returns true when at least one unknown field matches the descriptor and can be decoded as an extension value.


[View source]
def unknown_fields : Array(UnknownField) #

[View source]
def write_unknown_fields(writer : Wire::Writer) : Nil #

[View source]