#[non_exhaustive]pub struct FieldReference {
pub name: String,
pub sub_field: Option<Box<FieldReference>>,
pub index_or_key: Option<IndexOrKey>,
/* private fields */
}Expand description
Specifies a context for the validation error. A FieldReference always
refers to a given field in this file and follows the same hierarchical
structure. For example, we may specify element #2 of start_time_windows
of vehicle #5 using:
name: "vehicles" index: 5 sub_field { name: "end_time_windows" index: 2 }We however omit top-level entities such as OptimizeToursRequest or
ShipmentModel to avoid crowding the message.
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.name: StringName of the field, e.g., “vehicles”.
sub_field: Option<Box<FieldReference>>Recursively nested sub-field, if needed.
index_or_key: Option<IndexOrKey>Implementations§
Source§impl FieldReference
impl FieldReference
Sourcepub fn set_sub_field<T>(self, v: T) -> Selfwhere
T: Into<FieldReference>,
pub fn set_sub_field<T>(self, v: T) -> Selfwhere
T: Into<FieldReference>,
Sourcepub fn set_or_clear_sub_field<T>(self, v: Option<T>) -> Selfwhere
T: Into<FieldReference>,
pub fn set_or_clear_sub_field<T>(self, v: Option<T>) -> Selfwhere
T: Into<FieldReference>,
Sourcepub fn set_index_or_key<T: Into<Option<IndexOrKey>>>(self, v: T) -> Self
pub fn set_index_or_key<T: Into<Option<IndexOrKey>>>(self, v: T) -> Self
Sets the value of index_or_key.
Note that all the setters affecting index_or_key are mutually
exclusive.
§Example
use google_cloud_optimization_v1::model::optimize_tours_validation_error::field_reference::IndexOrKey;
let x = FieldReference::new().set_index_or_key(Some(IndexOrKey::Index(42)));Sourcepub fn index(&self) -> Option<&i32>
pub fn index(&self) -> Option<&i32>
The value of index_or_key
if it holds a Index, None if the field is not set or
holds a different branch.
Sourcepub fn set_index<T: Into<i32>>(self, v: T) -> Self
pub fn set_index<T: Into<i32>>(self, v: T) -> Self
Sets the value of index_or_key
to hold a Index.
Note that all the setters affecting index_or_key are
mutually exclusive.
§Example
let x = FieldReference::new().set_index(42);
assert!(x.index().is_some());
assert!(x.key().is_none());Sourcepub fn key(&self) -> Option<&String>
pub fn key(&self) -> Option<&String>
The value of index_or_key
if it holds a Key, None if the field is not set or
holds a different branch.
Trait Implementations§
Source§impl Clone for FieldReference
impl Clone for FieldReference
Source§fn clone(&self) -> FieldReference
fn clone(&self) -> FieldReference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldReference
impl Debug for FieldReference
Source§impl Default for FieldReference
impl Default for FieldReference
Source§fn default() -> FieldReference
fn default() -> FieldReference
Source§impl Message for FieldReference
impl Message for FieldReference
Source§impl PartialEq for FieldReference
impl PartialEq for FieldReference
impl StructuralPartialEq for FieldReference
Auto Trait Implementations§
impl Freeze for FieldReference
impl RefUnwindSafe for FieldReference
impl Send for FieldReference
impl Sync for FieldReference
impl Unpin for FieldReference
impl UnsafeUnpin for FieldReference
impl UnwindSafe for FieldReference
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request