pub struct RouteState { /* private fields */ }Expand description
Provides a way to associate arbitrary data within route or/and activity.
NOTE: do not put any state that is not refreshed after accept_route_state call: it will be
wiped out at some point.
Implementations§
Source§impl RouteState
impl RouteState
Sourcepub fn get_tour_state<K: 'static, V: Send + Sync + 'static>(&self) -> Option<&V>
pub fn get_tour_state<K: 'static, V: Send + Sync + 'static>(&self) -> Option<&V>
Gets a value associated with the tour using K type as a key.
Sourcepub fn set_tour_state<K: 'static, V: Send + Sync + 'static>(&mut self, value: V)
pub fn set_tour_state<K: 'static, V: Send + Sync + 'static>(&mut self, value: V)
Sets the value associated with the tour using K type as a key.
Sourcepub fn remove_tour_state<K: 'static>(&mut self) -> bool
pub fn remove_tour_state<K: 'static>(&mut self) -> bool
Removes the value associated with the tour using K type as a key. Returns true if the
value was present.
Sourcepub fn get_activity_state<K: 'static, V: Send + Sync + 'static>(
&self,
activity_idx: usize,
) -> Option<&V>
pub fn get_activity_state<K: 'static, V: Send + Sync + 'static>( &self, activity_idx: usize, ) -> Option<&V>
Gets value associated with a key converted to a given type.
Sourcepub fn get_activity_states<K: 'static, V: Send + Sync + 'static>(
&self,
) -> Option<&Vec<V>>
pub fn get_activity_states<K: 'static, V: Send + Sync + 'static>( &self, ) -> Option<&Vec<V>>
Gets values associated with key and activities.
Sourcepub fn set_activity_states<K: 'static, V: Send + Sync + 'static>(
&mut self,
values: Vec<V>,
)
pub fn set_activity_states<K: 'static, V: Send + Sync + 'static>( &mut self, values: Vec<V>, )
Adds values associated with activities.
Trait Implementations§
Source§impl Clone for RouteState
impl Clone for RouteState
Source§fn clone(&self) -> RouteState
fn clone(&self) -> RouteState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for RouteState
impl Default for RouteState
Source§fn default() -> RouteState
fn default() -> RouteState
Returns the “default value” for a type. Read more
Source§impl LimitDurationTourState for RouteState
impl LimitDurationTourState for RouteState
Source§fn get_limit_duration(&self) -> Option<&Duration>
fn get_limit_duration(&self) -> Option<&Duration>
Gets
LimitDuration tour state.Source§fn set_limit_duration(&mut self, value: Duration)
fn set_limit_duration(&mut self, value: Duration)
Sets
LimitDuration tour state.Source§fn remove_limit_duration(&mut self) -> bool
fn remove_limit_duration(&mut self) -> bool
Removes
LimitDuration tour state.Source§impl MaxVehicleLoadTourState for RouteState
impl MaxVehicleLoadTourState for RouteState
Source§fn get_max_vehicle_load(&self) -> Option<&Float>
fn get_max_vehicle_load(&self) -> Option<&Float>
Gets
MaxVehicleLoad tour state.Source§fn set_max_vehicle_load(&mut self, value: Float)
fn set_max_vehicle_load(&mut self, value: Float)
Sets
MaxVehicleLoad tour state.Source§fn remove_max_vehicle_load(&mut self) -> bool
fn remove_max_vehicle_load(&mut self) -> bool
Removes
MaxVehicleLoad tour state.Source§impl TotalDistanceTourState for RouteState
impl TotalDistanceTourState for RouteState
Source§fn get_total_distance(&self) -> Option<&Distance>
fn get_total_distance(&self) -> Option<&Distance>
Gets
TotalDistance tour state.Source§fn set_total_distance(&mut self, value: Distance)
fn set_total_distance(&mut self, value: Distance)
Sets
TotalDistance tour state.Source§fn remove_total_distance(&mut self) -> bool
fn remove_total_distance(&mut self) -> bool
Removes
TotalDistance tour state.Source§impl TotalDurationTourState for RouteState
impl TotalDurationTourState for RouteState
Source§fn get_total_duration(&self) -> Option<&Duration>
fn get_total_duration(&self) -> Option<&Duration>
Gets
TotalDuration tour state.Source§fn set_total_duration(&mut self, value: Duration)
fn set_total_duration(&mut self, value: Duration)
Sets
TotalDuration tour state.Source§fn remove_total_duration(&mut self) -> bool
fn remove_total_duration(&mut self) -> bool
Removes
TotalDuration tour state.Auto Trait Implementations§
impl Freeze for RouteState
impl !RefUnwindSafe for RouteState
impl Send for RouteState
impl Sync for RouteState
impl Unpin for RouteState
impl UnsafeUnpin for RouteState
impl !UnwindSafe for RouteState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more