#[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,
/* private fields */
}Expand description
A single field of a message type.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
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
pub fn new() -> Self
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.
§Example
ⓘ
use google_cloud_wkt::field::Cardinality;
let x0 = Field::new().set_cardinality(Cardinality::Optional);
let x1 = Field::new().set_cardinality(Cardinality::Required);
let x2 = Field::new().set_cardinality(Cardinality::Repeated);Sourcepub fn set_number<T: Into<i32>>(self, v: T) -> Self
pub fn set_number<T: Into<i32>>(self, v: T) -> Self
Sourcepub fn set_type_url<T: Into<String>>(self, v: T) -> Self
pub fn set_type_url<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_oneof_index<T: Into<i32>>(self, v: T) -> Self
pub fn set_oneof_index<T: Into<i32>>(self, v: T) -> Self
Sourcepub fn set_packed<T: Into<bool>>(self, v: T) -> Self
pub fn set_packed<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_options<T, V>(self, v: T) -> Self
pub fn set_options<T, V>(self, v: T) -> Self
Sourcepub fn set_json_name<T: Into<String>>(self, v: T) -> Self
pub fn set_json_name<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_default_value<T: Into<String>>(self, v: T) -> Self
pub fn set_default_value<T: Into<String>>(self, v: T) -> Self
Trait Implementations§
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more