#[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
pub fn new() -> Self
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>,
Sets the value of sub_field.
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>,
Sets or clears the value of sub_field.
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.
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.
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.
Sourcepub fn set_key<T: Into<String>>(self, v: T) -> Self
pub fn set_key<T: Into<String>>(self, v: T) -> Self
Sets the value of index_or_key
to hold a Key.
Note that all the setters affecting index_or_key are
mutually exclusive.
Trait Implementations§
Source§impl Clone for FieldReference
impl Clone for FieldReference
Source§fn clone(&self) -> FieldReference
fn clone(&self) -> FieldReference
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more