pub struct EdgeWeight {
pub distance: f64,
pub time: f64,
pub monetary: f64,
pub custom: HashMap<String, f64>,
}Expand description
Multi-criteria edge weight supporting distance, time, and custom costs
Fields§
§distance: f64Distance cost (e.g., meters)
time: f64Time cost (e.g., seconds)
monetary: f64Monetary cost (e.g., toll fees)
custom: HashMap<String, f64>Custom weight dimensions (named)
Implementations§
Source§impl EdgeWeight
impl EdgeWeight
Sourcepub fn from_distance(distance: f64) -> Self
pub fn from_distance(distance: f64) -> Self
Create a simple weight with only distance
Sourcepub fn from_distance_time(distance: f64, time: f64) -> Self
pub fn from_distance_time(distance: f64, time: f64) -> Self
Create a weight with distance and time
Sourcepub fn new(distance: f64, time: f64, monetary: f64) -> Self
pub fn new(distance: f64, time: f64, monetary: f64) -> Self
Create a weight with all three primary dimensions
Sourcepub fn with_custom(self, name: String, value: f64) -> Self
pub fn with_custom(self, name: String, value: f64) -> Self
Add a custom weight dimension
Trait Implementations§
Source§impl Clone for EdgeWeight
impl Clone for EdgeWeight
Source§fn clone(&self) -> EdgeWeight
fn clone(&self) -> EdgeWeight
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 Debug for EdgeWeight
impl Debug for EdgeWeight
Auto Trait Implementations§
impl Freeze for EdgeWeight
impl RefUnwindSafe for EdgeWeight
impl Send for EdgeWeight
impl Sync for EdgeWeight
impl Unpin for EdgeWeight
impl UnsafeUnpin for EdgeWeight
impl UnwindSafe for EdgeWeight
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