#[non_exhaustive]pub struct Reason {
pub code: Code,
pub example_vehicle_index: Option<i32>,
pub example_exceeded_capacity_type: String,
/* private fields */
}Expand description
If we can explain why the shipment was skipped, reasons will be listed
here. If the reason is not the same for all vehicles, reason will have
more than 1 element. A skipped shipment cannot have duplicate reasons,
i.e. where all fields are the same except for example_vehicle_index.
Example:
reasons {
code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
example_vehicle_index: 1
example_exceeded_capacity_type: "Apples"
}
reasons {
code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
example_vehicle_index: 3
example_exceeded_capacity_type: "Pears"
}
reasons {
code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
example_vehicle_index: 1
}The skipped shipment is incompatible with all vehicles. The reasons may be different for all vehicles but at least one vehicle’s “Apples” capacity would be exceeded (including vehicle 1), at least one vehicle’s “Pears” capacity would be exceeded (including vehicle 3) and at least one vehicle’s distance limit would be exceeded (including vehicle 1).
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.code: CodeRefer to the comments of Code.
example_vehicle_index: Option<i32>If the reason is related to a shipment-vehicle incompatibility, this field provides the index of one relevant vehicle.
example_exceeded_capacity_type: StringIf the reason code is DEMAND_EXCEEDS_VEHICLE_CAPACITY, documents one
capacity type that is exceeded.
Implementations§
Source§impl Reason
impl Reason
pub fn new() -> Self
Sourcepub fn set_code<T: Into<Code>>(self, v: T) -> Self
pub fn set_code<T: Into<Code>>(self, v: T) -> Self
Sets the value of code.
§Example
use google_cloud_optimization_v1::model::skipped_shipment::reason::Code;
let x0 = Reason::new().set_code(Code::NoVehicle);
let x1 = Reason::new().set_code(Code::DemandExceedsVehicleCapacity);
let x2 = Reason::new().set_code(Code::CannotBePerformedWithinVehicleDistanceLimit);Sourcepub fn set_example_vehicle_index<T>(self, v: T) -> Self
pub fn set_example_vehicle_index<T>(self, v: T) -> Self
Sets the value of example_vehicle_index.
§Example
let x = Reason::new().set_example_vehicle_index(42);Sourcepub fn set_or_clear_example_vehicle_index<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_example_vehicle_index<T>(self, v: Option<T>) -> Self
Sets or clears the value of example_vehicle_index.
§Example
let x = Reason::new().set_or_clear_example_vehicle_index(Some(42));
let x = Reason::new().set_or_clear_example_vehicle_index(None::<i32>);Sourcepub fn set_example_exceeded_capacity_type<T: Into<String>>(self, v: T) -> Self
pub fn set_example_exceeded_capacity_type<T: Into<String>>(self, v: T) -> Self
Sets the value of example_exceeded_capacity_type.
§Example
let x = Reason::new().set_example_exceeded_capacity_type("example");