#[non_exhaustive]pub struct FieldOptions {Show 14 fields
pub ctype: CType,
pub packed: bool,
pub jstype: JSType,
pub lazy: bool,
pub unverified_lazy: bool,
pub deprecated: bool,
pub weak: bool,
pub debug_redact: bool,
pub retention: OptionRetention,
pub targets: Vec<OptionTargetType>,
pub edition_defaults: Vec<EditionDefault>,
pub features: Option<FeatureSet>,
pub feature_support: Option<FeatureSupport>,
pub uninterpreted_option: Vec<UninterpretedOption>,
/* private fields */
}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.ctype: CTypeNOTE: ctype is deprecated. Use features.(pb.cpp).string_type instead.
The ctype option instructs the C++ code generator to use a different
representation of the field than it normally would. See the specific
options below. This option is only implemented to support use of
[ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
type “bytes” in the open source release.
TODO: make ctype actually deprecated.
packed: boolThe packed option can be enabled for repeated primitive fields to enable
a more efficient representation on the wire. Rather than repeatedly
writing the tag and type for each element, the entire array is encoded as
a single length-delimited blob. In proto3, only explicit setting it to
false will avoid using packed encoding. This option is prohibited in
Editions, but the repeated_field_encoding feature can be used to control
the behavior.
jstype: JSTypeThe jstype option determines the JavaScript type used for values of the field. The option is permitted only for 64 bit integral and fixed types (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING is represented as JavaScript string, which avoids loss of precision that can happen when a large value is converted to a floating point JavaScript. Specifying JS_NUMBER for the jstype causes the generated JavaScript code to use the JavaScript “number” type. The behavior of the default option JS_NORMAL is implementation dependent.
This option is an enum to permit additional types to be added, e.g. goog.math.Integer.
lazy: boolShould this field be parsed lazily? Lazy applies only to message-type fields. It means that when the outer message is initially parsed, the inner message’s contents will not be parsed but instead stored in encoded form. The inner message will actually be parsed when it is first accessed.
This is only a hint. Implementations are free to choose whether to use eager or lazy parsing regardless of the value of this option. However, setting this option true suggests that the protocol author believes that using lazy parsing on this field is worth the additional bookkeeping overhead typically needed to implement it.
This option does not affect the public interface of any generated code; all method signatures remain the same. Furthermore, thread-safety of the interface is not affected by this option; const methods remain safe to call from multiple threads concurrently, while non-const methods continue to require exclusive access.
Note that lazy message fields are still eagerly verified to check ill-formed wireformat or missing required fields. Calling IsInitialized() on the outer message would fail if the inner message has missing required fields. Failed verification would result in parsing failure (except when uninitialized messages are acceptable).
unverified_lazy: boolunverified_lazy does no correctness checks on the byte stream. This should only be used where lazy with verification is prohibitive for performance reasons.
deprecated: boolIs this field deprecated? Depending on the target platform, this can emit Deprecated annotations for accessors, or it will be completely ignored; in the very least, this is a formalization for deprecating fields.
weak: boolFor Google-internal migration only. Do not use.
debug_redact: boolIndicate that the field value should not be printed out when using debug formats, e.g. when the field contains sensitive credentials.
retention: OptionRetention§targets: Vec<OptionTargetType>§edition_defaults: Vec<EditionDefault>§features: Option<FeatureSet>Any features defined in the specific edition.
feature_support: Option<FeatureSupport>§uninterpreted_option: Vec<UninterpretedOption>The parser stores options it doesn’t recognize here. See above.
Implementations§
Source§impl FieldOptions
impl FieldOptions
pub fn new() -> 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_jstype<T: Into<JSType>>(self, v: T) -> Self
pub fn set_jstype<T: Into<JSType>>(self, v: T) -> Self
Sourcepub fn set_unverified_lazy<T: Into<bool>>(self, v: T) -> Self
pub fn set_unverified_lazy<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_deprecated<T: Into<bool>>(self, v: T) -> Self
pub fn set_deprecated<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_debug_redact<T: Into<bool>>(self, v: T) -> Self
pub fn set_debug_redact<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_retention<T: Into<OptionRetention>>(self, v: T) -> Self
pub fn set_retention<T: Into<OptionRetention>>(self, v: T) -> Self
Sourcepub fn set_targets<T, V>(self, v: T) -> Self
pub fn set_targets<T, V>(self, v: T) -> Self
Sourcepub fn set_edition_defaults<T, V>(self, v: T) -> Self
pub fn set_edition_defaults<T, V>(self, v: T) -> Self
Sets the value of edition_defaults.
§Example
use google_cloud_wkt::field_options::EditionDefault;
let x = FieldOptions::new()
.set_edition_defaults([
EditionDefault::default()/* use setters */,
EditionDefault::default()/* use (different) setters */,
]);Sourcepub fn set_features<T>(self, v: T) -> Selfwhere
T: Into<FeatureSet>,
pub fn set_features<T>(self, v: T) -> Selfwhere
T: Into<FeatureSet>,
Sourcepub fn set_or_clear_features<T>(self, v: Option<T>) -> Selfwhere
T: Into<FeatureSet>,
pub fn set_or_clear_features<T>(self, v: Option<T>) -> Selfwhere
T: Into<FeatureSet>,
Sourcepub fn set_feature_support<T>(self, v: T) -> Selfwhere
T: Into<FeatureSupport>,
pub fn set_feature_support<T>(self, v: T) -> Selfwhere
T: Into<FeatureSupport>,
Sets the value of feature_support.
§Example
use google_cloud_wkt::field_options::FeatureSupport;
let x = FieldOptions::new().set_feature_support(FeatureSupport::default()/* use setters */);Sourcepub fn set_or_clear_feature_support<T>(self, v: Option<T>) -> Selfwhere
T: Into<FeatureSupport>,
pub fn set_or_clear_feature_support<T>(self, v: Option<T>) -> Selfwhere
T: Into<FeatureSupport>,
Sets or clears the value of feature_support.
§Example
use google_cloud_wkt::field_options::FeatureSupport;
let x = FieldOptions::new().set_or_clear_feature_support(Some(FeatureSupport::default()/* use setters */));
let x = FieldOptions::new().set_or_clear_feature_support(None::<FeatureSupport>);Sourcepub fn set_uninterpreted_option<T, V>(self, v: T) -> Self
pub fn set_uninterpreted_option<T, V>(self, v: T) -> Self
Sets the value of uninterpreted_option.
§Example
use google_cloud_wkt::UninterpretedOption;
let x = FieldOptions::new()
.set_uninterpreted_option([
UninterpretedOption::default()/* use setters */,
UninterpretedOption::default()/* use (different) setters */,
]);Trait Implementations§
Source§impl Clone for FieldOptions
impl Clone for FieldOptions
Source§fn clone(&self) -> FieldOptions
fn clone(&self) -> FieldOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more