Transition

Struct Transition 

Source
#[non_exhaustive]
pub struct Transition { pub travel_duration: Option<Duration>, pub travel_distance_meters: f64, pub traffic_info_unavailable: bool, pub delay_duration: Option<Duration>, pub break_duration: Option<Duration>, pub wait_duration: Option<Duration>, pub total_duration: Option<Duration>, pub start_time: Option<Timestamp>, pub route_polyline: Option<EncodedPolyline>, pub vehicle_loads: HashMap<String, VehicleLoad>, pub loads: Vec<CapacityQuantity>, /* private fields */ }
Expand description

Transition between two events on the route. See the description of ShipmentRoute.

If the vehicle does not have a start_location and/or end_location, the corresponding travel metrics are 0.

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.
§travel_duration: Option<Duration>

Travel duration during this transition.

§travel_distance_meters: f64

Distance traveled during the transition.

§traffic_info_unavailable: bool

When traffic is requested via [OptimizeToursRequest.consider_road_traffic] [google.cloud.optimization.v1.OptimizeToursRequest.consider_road_traffic], and the traffic info couldn’t be retrieved for a Transition, this boolean is set to true. This may be temporary (rare hiccup in the realtime traffic servers) or permanent (no data for this location).

§delay_duration: Option<Duration>

Sum of the delay durations applied to this transition. If any, the delay starts exactly delay_duration seconds before the next event (visit or vehicle end). See TransitionAttributes.delay.

§break_duration: Option<Duration>

Sum of the duration of the breaks occurring during this transition, if any. Details about each break’s start time and duration are stored in ShipmentRoute.breaks.

§wait_duration: Option<Duration>

Time spent waiting during this transition. Wait duration corresponds to idle time and does not include break time. Also note that this wait time may be split into several non-contiguous intervals.

§total_duration: Option<Duration>

Total duration of the transition, provided for convenience. It is equal to:

  • next visit start_time (or vehicle_end_time if this is the last transition) - this transition’s start_time;
  • if ShipmentRoute.has_traffic_infeasibilities is false, the following additionally holds: `total_duration = travel_duration + delay_duration
  • break_duration + wait_duration`.
§start_time: Option<Timestamp>

Start time of this transition.

§route_polyline: Option<EncodedPolyline>

The encoded polyline representation of the route followed during the transition. This field is only populated if [populate_transition_polylines] [google.cloud.optimization.v1.OptimizeToursRequest.populate_transition_polylines] is set to true.

§vehicle_loads: HashMap<String, VehicleLoad>

Vehicle loads during this transition, for each type that either appears in this vehicle’s Vehicle.load_limits, or that have non-zero Shipment.load_demands on some shipment performed on this route.

The loads during the first transition are the starting loads of the vehicle route. Then, after each visit, the visit’s load_demands are either added or subtracted to get the next transition’s loads, depending on whether the visit was a pickup or a delivery.

§loads: Vec<CapacityQuantity>
👎Deprecated

Deprecated: Use Transition.vehicle_loads instead.

Implementations§

Source§

impl Transition

Source

pub fn new() -> Self

Source

pub fn set_travel_duration<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of travel_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_travel_duration(Duration::default()/* use setters */);
Source

pub fn set_or_clear_travel_duration<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of travel_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_or_clear_travel_duration(Some(Duration::default()/* use setters */));
let x = Transition::new().set_or_clear_travel_duration(None::<Duration>);
Source

pub fn set_travel_distance_meters<T: Into<f64>>(self, v: T) -> Self

Sets the value of travel_distance_meters.

§Example
let x = Transition::new().set_travel_distance_meters(42.0);
Source

pub fn set_traffic_info_unavailable<T: Into<bool>>(self, v: T) -> Self

Sets the value of traffic_info_unavailable.

§Example
let x = Transition::new().set_traffic_info_unavailable(true);
Source

pub fn set_delay_duration<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of delay_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_delay_duration(Duration::default()/* use setters */);
Source

pub fn set_or_clear_delay_duration<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of delay_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_or_clear_delay_duration(Some(Duration::default()/* use setters */));
let x = Transition::new().set_or_clear_delay_duration(None::<Duration>);
Source

pub fn set_break_duration<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of break_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_break_duration(Duration::default()/* use setters */);
Source

pub fn set_or_clear_break_duration<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of break_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_or_clear_break_duration(Some(Duration::default()/* use setters */));
let x = Transition::new().set_or_clear_break_duration(None::<Duration>);
Source

pub fn set_wait_duration<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of wait_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_wait_duration(Duration::default()/* use setters */);
Source

pub fn set_or_clear_wait_duration<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of wait_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_or_clear_wait_duration(Some(Duration::default()/* use setters */));
let x = Transition::new().set_or_clear_wait_duration(None::<Duration>);
Source

pub fn set_total_duration<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of total_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_total_duration(Duration::default()/* use setters */);
Source

pub fn set_or_clear_total_duration<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of total_duration.

§Example
use wkt::Duration;
let x = Transition::new().set_or_clear_total_duration(Some(Duration::default()/* use setters */));
let x = Transition::new().set_or_clear_total_duration(None::<Duration>);
Source

pub fn set_start_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of start_time.

§Example
use wkt::Timestamp;
let x = Transition::new().set_start_time(Timestamp::default()/* use setters */);
Source

pub fn set_or_clear_start_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of start_time.

§Example
use wkt::Timestamp;
let x = Transition::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
let x = Transition::new().set_or_clear_start_time(None::<Timestamp>);
Source

pub fn set_route_polyline<T>(self, v: T) -> Self

Sets the value of route_polyline.

§Example
use google_cloud_optimization_v1::model::shipment_route::EncodedPolyline;
let x = Transition::new().set_route_polyline(EncodedPolyline::default()/* use setters */);
Source

pub fn set_or_clear_route_polyline<T>(self, v: Option<T>) -> Self

Sets or clears the value of route_polyline.

§Example
use google_cloud_optimization_v1::model::shipment_route::EncodedPolyline;
let x = Transition::new().set_or_clear_route_polyline(Some(EncodedPolyline::default()/* use setters */));
let x = Transition::new().set_or_clear_route_polyline(None::<EncodedPolyline>);
Source

pub fn set_vehicle_loads<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<VehicleLoad>,

Sets the value of vehicle_loads.

§Example
use google_cloud_optimization_v1::model::shipment_route::VehicleLoad;
let x = Transition::new().set_vehicle_loads([
    ("key0", VehicleLoad::default()/* use setters */),
    ("key1", VehicleLoad::default()/* use (different) setters */),
]);
Source

pub fn set_loads<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<CapacityQuantity>,

👎Deprecated

Sets the value of loads.

§Example
use google_cloud_optimization_v1::model::CapacityQuantity;
let x = Transition::new()
    .set_loads([
        CapacityQuantity::default()/* use setters */,
        CapacityQuantity::default()/* use (different) setters */,
    ]);

Trait Implementations§

Source§

impl Clone for Transition

Source§

fn clone(&self) -> Transition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Transition

Source§

fn default() -> Transition

Returns the “default value” for a type. Read more
Source§

impl Message for Transition

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Transition

Source§

fn eq(&self, other: &Transition) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Transition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,