Skip to main content

ProtoFieldType

Enum ProtoFieldType 

Source
#[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

Source

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).

Source

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:

These are handled by the descriptor mapper (CP-A3), not here.

Trait Implementations§

Source§

impl Clone for ProtoFieldType

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ProtoFieldType

Source§

impl Debug for ProtoFieldType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ProtoFieldType

Source§

impl PartialEq for ProtoFieldType

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProtoFieldType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.