#[non_exhaustive]pub struct LoadLimit {
pub max_load: Option<i64>,
pub soft_max_load: i64,
pub cost_per_unit_above_soft_max: f64,
pub start_load_interval: Option<Interval>,
pub end_load_interval: Option<Interval>,
/* private fields */
}Expand description
Defines a load limit applying to a vehicle, e.g. “this truck may only carry up to 3500 kg”. See load_limits.
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.max_load: Option<i64>The maximum acceptable amount of load.
soft_max_load: i64A soft limit of the load. See cost_per_unit_above_soft_max.
cost_per_unit_above_soft_max: f64If the load ever exceeds soft_max_load along this vehicle’s route, the following cost penalty applies (only once per vehicle): (load - soft_max_load)
- cost_per_unit_above_soft_max. All costs add up and must be in the same unit as Shipment.penalty_cost.
start_load_interval: Option<Interval>The acceptable load interval of the vehicle at the start of the route.
end_load_interval: Option<Interval>The acceptable load interval of the vehicle at the end of the route.
Implementations§
Source§impl LoadLimit
impl LoadLimit
pub fn new() -> Self
Sourcepub fn set_max_load<T>(self, v: T) -> Self
pub fn set_max_load<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_max_load<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_max_load<T>(self, v: Option<T>) -> Self
Sourcepub fn set_soft_max_load<T: Into<i64>>(self, v: T) -> Self
pub fn set_soft_max_load<T: Into<i64>>(self, v: T) -> Self
Sourcepub fn set_cost_per_unit_above_soft_max<T: Into<f64>>(self, v: T) -> Self
pub fn set_cost_per_unit_above_soft_max<T: Into<f64>>(self, v: T) -> Self
Sets the value of cost_per_unit_above_soft_max.
§Example
ⓘ
let x = LoadLimit::new().set_cost_per_unit_above_soft_max(42.0);Sourcepub fn set_start_load_interval<T>(self, v: T) -> Self
pub fn set_start_load_interval<T>(self, v: T) -> Self
Sets the value of start_load_interval.
§Example
ⓘ
use google_cloud_optimization_v1::model::vehicle::load_limit::Interval;
let x = LoadLimit::new().set_start_load_interval(Interval::default()/* use setters */);Sourcepub fn set_or_clear_start_load_interval<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_start_load_interval<T>(self, v: Option<T>) -> Self
Sets or clears the value of start_load_interval.
§Example
ⓘ
use google_cloud_optimization_v1::model::vehicle::load_limit::Interval;
let x = LoadLimit::new().set_or_clear_start_load_interval(Some(Interval::default()/* use setters */));
let x = LoadLimit::new().set_or_clear_start_load_interval(None::<Interval>);Sourcepub fn set_end_load_interval<T>(self, v: T) -> Self
pub fn set_end_load_interval<T>(self, v: T) -> Self
Sets the value of end_load_interval.
§Example
ⓘ
use google_cloud_optimization_v1::model::vehicle::load_limit::Interval;
let x = LoadLimit::new().set_end_load_interval(Interval::default()/* use setters */);Sourcepub fn set_or_clear_end_load_interval<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_end_load_interval<T>(self, v: Option<T>) -> Self
Sets or clears the value of end_load_interval.
§Example
ⓘ
use google_cloud_optimization_v1::model::vehicle::load_limit::Interval;
let x = LoadLimit::new().set_or_clear_end_load_interval(Some(Interval::default()/* use setters */));
let x = LoadLimit::new().set_or_clear_end_load_interval(None::<Interval>);Trait Implementations§
impl StructuralPartialEq for LoadLimit
Auto Trait Implementations§
impl Freeze for LoadLimit
impl RefUnwindSafe for LoadLimit
impl Send for LoadLimit
impl Sync for LoadLimit
impl Unpin for LoadLimit
impl UnwindSafe for LoadLimit
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