#[non_exhaustive]pub struct DurationLimit {
pub max_duration: Option<Duration>,
pub soft_max_duration: Option<Duration>,
pub cost_per_hour_after_soft_max: Option<f64>,
pub quadratic_soft_max_duration: Option<Duration>,
pub cost_per_square_hour_after_quadratic_soft_max: Option<f64>,
/* private fields */
}Expand description
A limit defining a maximum duration of the route of a vehicle. It can be either hard or soft.
When a soft limit field is defined, both the soft max threshold and its associated cost must be defined together.
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.max_duration: Option<Duration>A hard limit constraining the duration to be at most max_duration.
soft_max_duration: Option<Duration>A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost. This cost adds up to other costs defined in the model, with the same unit.
If defined, soft_max_duration must be nonnegative. If max_duration is
also defined, soft_max_duration must be less than max_duration.
cost_per_hour_after_soft_max: Option<f64>Cost per hour incurred if the soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold,
otherwise the cost depends on the duration as follows:
cost_per_hour_after_soft_max * (duration - soft_max_duration)The cost must be nonnegative.
quadratic_soft_max_duration: Option<Duration>A soft limit not enforcing a maximum duration limit, but when violated makes the route incur a cost, quadratic in the duration. This cost adds up to other costs defined in the model, with the same unit.
If defined, quadratic_soft_max_duration must be nonnegative. If
max_duration is also defined, quadratic_soft_max_duration must be
less than max_duration, and the difference must be no larger than one
day:
max_duration - quadratic_soft_max_duration <= 86400 seconds
cost_per_square_hour_after_quadratic_soft_max: Option<f64>Cost per square hour incurred if the
quadratic_soft_max_duration threshold is violated.
The additional cost is 0 if the duration is under the threshold, otherwise the cost depends on the duration as follows:
cost_per_square_hour_after_quadratic_soft_max *
(duration - quadratic_soft_max_duration)^2The cost must be nonnegative.
Implementations§
Source§impl DurationLimit
impl DurationLimit
Sourcepub fn set_max_duration<T>(self, v: T) -> Self
pub fn set_max_duration<T>(self, v: T) -> Self
Sets the value of max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_max_duration(Duration::default()/* use setters */);Sourcepub fn set_or_clear_max_duration<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_max_duration<T>(self, v: Option<T>) -> Self
Sets or clears the value of max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_or_clear_max_duration(Some(Duration::default()/* use setters */));
let x = DurationLimit::new().set_or_clear_max_duration(None::<Duration>);Sourcepub fn set_soft_max_duration<T>(self, v: T) -> Self
pub fn set_soft_max_duration<T>(self, v: T) -> Self
Sets the value of soft_max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_soft_max_duration(Duration::default()/* use setters */);Sourcepub fn set_or_clear_soft_max_duration<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_soft_max_duration<T>(self, v: Option<T>) -> Self
Sets or clears the value of soft_max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_or_clear_soft_max_duration(Some(Duration::default()/* use setters */));
let x = DurationLimit::new().set_or_clear_soft_max_duration(None::<Duration>);Sourcepub fn set_cost_per_hour_after_soft_max<T>(self, v: T) -> Self
pub fn set_cost_per_hour_after_soft_max<T>(self, v: T) -> Self
Sets the value of cost_per_hour_after_soft_max.
§Example
let x = DurationLimit::new().set_cost_per_hour_after_soft_max(42.0);Sourcepub fn set_or_clear_cost_per_hour_after_soft_max<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_cost_per_hour_after_soft_max<T>(self, v: Option<T>) -> Self
Sets or clears the value of cost_per_hour_after_soft_max.
§Example
let x = DurationLimit::new().set_or_clear_cost_per_hour_after_soft_max(Some(42.0));
let x = DurationLimit::new().set_or_clear_cost_per_hour_after_soft_max(None::<f32>);Sourcepub fn set_quadratic_soft_max_duration<T>(self, v: T) -> Self
pub fn set_quadratic_soft_max_duration<T>(self, v: T) -> Self
Sets the value of quadratic_soft_max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_quadratic_soft_max_duration(Duration::default()/* use setters */);Sourcepub fn set_or_clear_quadratic_soft_max_duration<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_quadratic_soft_max_duration<T>(self, v: Option<T>) -> Self
Sets or clears the value of quadratic_soft_max_duration.
§Example
use wkt::Duration;
let x = DurationLimit::new().set_or_clear_quadratic_soft_max_duration(Some(Duration::default()/* use setters */));
let x = DurationLimit::new().set_or_clear_quadratic_soft_max_duration(None::<Duration>);Sourcepub fn set_cost_per_square_hour_after_quadratic_soft_max<T>(self, v: T) -> Self
pub fn set_cost_per_square_hour_after_quadratic_soft_max<T>(self, v: T) -> Self
Sets the value of cost_per_square_hour_after_quadratic_soft_max.
§Example
let x = DurationLimit::new().set_cost_per_square_hour_after_quadratic_soft_max(42.0);Sourcepub fn set_or_clear_cost_per_square_hour_after_quadratic_soft_max<T>(
self,
v: Option<T>,
) -> Self
pub fn set_or_clear_cost_per_square_hour_after_quadratic_soft_max<T>( self, v: Option<T>, ) -> Self
Sets or clears the value of cost_per_square_hour_after_quadratic_soft_max.
§Example
let x = DurationLimit::new().set_or_clear_cost_per_square_hour_after_quadratic_soft_max(Some(42.0));
let x = DurationLimit::new().set_or_clear_cost_per_square_hour_after_quadratic_soft_max(None::<f32>);Trait Implementations§
Source§impl Clone for DurationLimit
impl Clone for DurationLimit
Source§fn clone(&self) -> DurationLimit
fn clone(&self) -> DurationLimit
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 DurationLimit
impl Debug for DurationLimit
Source§impl Default for DurationLimit
impl Default for DurationLimit
Source§fn default() -> DurationLimit
fn default() -> DurationLimit
Source§impl Message for DurationLimit
impl Message for DurationLimit
Source§impl PartialEq for DurationLimit
impl PartialEq for DurationLimit
impl StructuralPartialEq for DurationLimit
Auto Trait Implementations§
impl Freeze for DurationLimit
impl RefUnwindSafe for DurationLimit
impl Send for DurationLimit
impl Sync for DurationLimit
impl Unpin for DurationLimit
impl UnsafeUnpin for DurationLimit
impl UnwindSafe for DurationLimit
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