#[non_exhaustive]pub struct Field {
    pub kind: Kind,
    pub cardinality: Cardinality,
    pub number: i32,
    pub name: String,
    pub type_url: String,
    pub oneof_index: i32,
    pub packed: bool,
    pub options: Vec<Option>,
    pub json_name: String,
    pub default_value: String,
}Expand description
A single field of a message type.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: KindThe field type.
cardinality: CardinalityThe field cardinality.
number: i32The field number.
name: StringThe field name.
type_url: StringThe field type URL, without the scheme, for message or enumeration
types. Example: "type.googleapis.com/google.protobuf.Timestamp".
oneof_index: i32The index of the field type in Type.oneofs, for message or enumeration
types. The first type has index 1; zero means the type is not in the list.
packed: boolWhether to use alternative packed wire representation.
options: Vec<Option>The protocol buffer options.
json_name: StringThe field JSON name.
default_value: StringThe string value of the default value of this field. Proto2 syntax only.
Implementations§
Source§impl Field
 
impl Field
Sourcepub fn set_cardinality<T: Into<Cardinality>>(self, v: T) -> Self
 
pub fn set_cardinality<T: Into<Cardinality>>(self, v: T) -> Self
Sets the value of cardinality.
Sourcepub fn set_number<T: Into<i32>>(self, v: T) -> Self
 
pub fn set_number<T: Into<i32>>(self, v: T) -> Self
Sets the value of number.
Sourcepub fn set_type_url<T: Into<String>>(self, v: T) -> Self
 
pub fn set_type_url<T: Into<String>>(self, v: T) -> Self
Sets the value of type_url.
Sourcepub fn set_oneof_index<T: Into<i32>>(self, v: T) -> Self
 
pub fn set_oneof_index<T: Into<i32>>(self, v: T) -> Self
Sets the value of oneof_index.
Sourcepub fn set_packed<T: Into<bool>>(self, v: T) -> Self
 
pub fn set_packed<T: Into<bool>>(self, v: T) -> Self
Sets the value of packed.
Sourcepub fn set_json_name<T: Into<String>>(self, v: T) -> Self
 
pub fn set_json_name<T: Into<String>>(self, v: T) -> Self
Sets the value of json_name.
Sourcepub fn set_default_value<T: Into<String>>(self, v: T) -> Self
 
pub fn set_default_value<T: Into<String>>(self, v: T) -> Self
Sets the value of default_value.
Sourcepub fn set_options<T, V>(self, v: T) -> Self
 
pub fn set_options<T, V>(self, v: T) -> Self
Sets the value of options.