#[non_exhaustive]pub struct DistanceLimit {
pub max_meters: Option<i64>,
pub soft_max_meters: Option<i64>,
pub cost_per_kilometer_below_soft_max: Option<f64>,
pub cost_per_kilometer_above_soft_max: Option<f64>,
/* private fields */
}Expand description
A limit defining a maximum distance which can be traveled. It can be either hard or soft.
If a soft limit is defined, both soft_max_meters and
cost_per_kilometer_above_soft_max must be defined and be nonnegative.
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_meters: Option<i64>A hard limit constraining the distance to be at most max_meters. The limit must be nonnegative.
soft_max_meters: Option<i64>A soft limit not enforcing a maximum distance limit, but when violated results in a cost which adds up to other costs defined in the model, with the same unit.
If defined soft_max_meters must be less than max_meters and must be nonnegative.
cost_per_kilometer_below_soft_max: Option<f64>Cost per kilometer incurred, increasing up to soft_max_meters, with
formula:
min(distance_meters, soft_max_meters) / 1000.0 *
cost_per_kilometer_below_soft_max.This cost is not supported in route_distance_limit.
cost_per_kilometer_above_soft_max: Option<f64>Cost per kilometer incurred if distance is above soft_max_meters limit.
The additional cost is 0 if the distance is under the limit, otherwise the
formula used to compute the cost is the following:
(distance_meters - soft_max_meters) / 1000.0 *
cost_per_kilometer_above_soft_max.The cost must be nonnegative.
Implementations§
Source§impl DistanceLimit
impl DistanceLimit
Sourcepub fn set_max_meters<T>(self, v: T) -> Self
pub fn set_max_meters<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_max_meters<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_max_meters<T>(self, v: Option<T>) -> Self
Sets or clears the value of max_meters.
§Example
let x = DistanceLimit::new().set_or_clear_max_meters(Some(42));
let x = DistanceLimit::new().set_or_clear_max_meters(None::<i32>);Sourcepub fn set_soft_max_meters<T>(self, v: T) -> Self
pub fn set_soft_max_meters<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_soft_max_meters<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_soft_max_meters<T>(self, v: Option<T>) -> Self
Sets or clears the value of soft_max_meters.
§Example
let x = DistanceLimit::new().set_or_clear_soft_max_meters(Some(42));
let x = DistanceLimit::new().set_or_clear_soft_max_meters(None::<i32>);Sourcepub fn set_cost_per_kilometer_below_soft_max<T>(self, v: T) -> Self
pub fn set_cost_per_kilometer_below_soft_max<T>(self, v: T) -> Self
Sets the value of cost_per_kilometer_below_soft_max.
§Example
let x = DistanceLimit::new().set_cost_per_kilometer_below_soft_max(42.0);Sourcepub fn set_or_clear_cost_per_kilometer_below_soft_max<T>(
self,
v: Option<T>,
) -> Self
pub fn set_or_clear_cost_per_kilometer_below_soft_max<T>( self, v: Option<T>, ) -> Self
Sets or clears the value of cost_per_kilometer_below_soft_max.
§Example
let x = DistanceLimit::new().set_or_clear_cost_per_kilometer_below_soft_max(Some(42.0));
let x = DistanceLimit::new().set_or_clear_cost_per_kilometer_below_soft_max(None::<f32>);Sourcepub fn set_cost_per_kilometer_above_soft_max<T>(self, v: T) -> Self
pub fn set_cost_per_kilometer_above_soft_max<T>(self, v: T) -> Self
Sets the value of cost_per_kilometer_above_soft_max.
§Example
let x = DistanceLimit::new().set_cost_per_kilometer_above_soft_max(42.0);Sourcepub fn set_or_clear_cost_per_kilometer_above_soft_max<T>(
self,
v: Option<T>,
) -> Self
pub fn set_or_clear_cost_per_kilometer_above_soft_max<T>( self, v: Option<T>, ) -> Self
Sets or clears the value of cost_per_kilometer_above_soft_max.
§Example
let x = DistanceLimit::new().set_or_clear_cost_per_kilometer_above_soft_max(Some(42.0));
let x = DistanceLimit::new().set_or_clear_cost_per_kilometer_above_soft_max(None::<f32>);Trait Implementations§
Source§impl Clone for DistanceLimit
impl Clone for DistanceLimit
Source§fn clone(&self) -> DistanceLimit
fn clone(&self) -> DistanceLimit
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 DistanceLimit
impl Debug for DistanceLimit
Source§impl Default for DistanceLimit
impl Default for DistanceLimit
Source§fn default() -> DistanceLimit
fn default() -> DistanceLimit
Source§impl Message for DistanceLimit
impl Message for DistanceLimit
Source§impl PartialEq for DistanceLimit
impl PartialEq for DistanceLimit
impl StructuralPartialEq for DistanceLimit
Auto Trait Implementations§
impl Freeze for DistanceLimit
impl RefUnwindSafe for DistanceLimit
impl Send for DistanceLimit
impl Sync for DistanceLimit
impl Unpin for DistanceLimit
impl UnsafeUnpin for DistanceLimit
impl UnwindSafe for DistanceLimit
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