pub struct FieldDescriptor { /* private fields */ }
Expand description

Field descriptor.

Can be used for runtime reflection.

Implementations

Get .proto description of field

Field name as specified in .proto file

JSON field name.

Can be different from .proto field name.

See JSON mapping for details.

If this field repeated?

Check if field is set in given message.

For repeated field or map field return true if collection is not empty.

Panics

If this field belongs to a different message type.

Return length of repeated field.

For singular field return 1 if field is set and 0 otherwise.

Panics

If this field belongs to a different message type.

Get message field or default instance if field is unset.

Panics

If this field belongs to a different message type or field type is not message.

Get enum field.

Panics

If this field belongs to a different message type or field type is not singular enum.

Get string field.

Panics

If this field belongs to a different message type or field type is not singular string.

Get bytes field.

Panics

If this field belongs to a different message type or field type is not singular bytes.

Get u32 field.

Panics

If this field belongs to a different message type or field type is not singular u32.

Get u64 field.

Panics

If this field belongs to a different message type or field type is not singular u64.

Get i32 field.

Panics

If this field belongs to a different message type or field type is not singular i32.

Get i64 field.

Panics

If this field belongs to a different message type or field type is not singular i64.

Get bool field.

Panics

If this field belongs to a different message type or field type is not singular bool.

Get float field.

Panics

If this field belongs to a different message type or field type is not singular float.

Get double field.

Panics

If this field belongs to a different message type or field type is not singular double.

Get field of any type.

Panics

If this field belongs to a different message type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.