#[repr(u8)]pub enum ProtoFieldType {
Show 18 variants
Double = 1,
Float = 2,
Int64 = 3,
Uint64 = 4,
Int32 = 5,
Fixed64 = 6,
Fixed32 = 7,
Bool = 8,
String = 9,
Group = 10,
Message = 11,
Bytes = 12,
Uint32 = 13,
Enum = 14,
Sfixed32 = 15,
Sfixed64 = 16,
Sint32 = 17,
Sint64 = 18,
}Expand description
A Protocol Buffers field type, i.e. FieldDescriptorProto.Type in
descriptor.proto. The discriminants are the on-the-wire enum values.
Variants§
Double = 1
double -> f64.
Float = 2
float -> f32.
Int64 = 3
int64 (varint) -> i64.
Uint64 = 4
uint64 (varint) -> u64.
Int32 = 5
int32 (varint) -> i32.
Fixed64 = 6
fixed64 (8 bytes) -> u64.
Fixed32 = 7
fixed32 (4 bytes) -> u32.
Bool = 8
bool -> boolean.
String = 9
string (UTF-8) -> XTypes string.
Group = 10
Deprecated proto2 group, mapped like a nested message.
Message = 11
Nested message -> nested struct (resolved from type_name).
Bytes = 12
bytes -> sequence<byte>.
Uint32 = 13
uint32 (varint) -> u32.
Enum = 14
enum -> XTypes enum (resolved from type_name).
Sfixed32 = 15
sfixed32 (4 bytes, signed) -> i32.
Sfixed64 = 16
sfixed64 (8 bytes, signed) -> i64.
Sint32 = 17
sint32 (zigzag varint) -> i32.
Sint64 = 18
sint64 (zigzag varint) -> i64.
Implementations§
Source§impl ProtoFieldType
impl ProtoFieldType
Sourcepub fn from_wire(v: i32) -> Option<Self>
pub fn from_wire(v: i32) -> Option<Self>
Decode the FieldDescriptorProto.Type enum value. Returns None for
out-of-range values (a malformed or newer descriptor).
Sourcepub fn scalar_type_kind(self) -> Option<TypeKind>
pub fn scalar_type_kind(self) -> Option<TypeKind>
The XTypes TypeKind for a directly-representable field type.
None for the field types that do not map to a single primitive:
ProtoFieldType::Bytes->sequence<byte>(a collection),ProtoFieldType::Message/ProtoFieldType::Group-> a nested struct (resolved from the descriptor’stype_name),ProtoFieldType::Enum-> an XTypes enum (resolved fromtype_name).
These are handled by the descriptor mapper (CP-A3), not here.