pub enum WeightConfig {
Property {
name: String,
default_weight: f64,
},
Constant(f64),
}Expand description
Weight extraction configuration.
Defines how edge weights are extracted from edge properties.
Variants§
Property
Use a specific property name as the weight.
Falls back to default_weight if the property is not found.
Fields
Constant(f64)
Use a constant weight for all edges.
Implementations§
Source§impl WeightConfig
impl WeightConfig
Sourcepub fn property(name: impl Into<String>) -> Self
pub fn property(name: impl Into<String>) -> Self
Create a weight config that uses a specific property.
Sourcepub fn property_with_default(name: impl Into<String>, default: f64) -> Self
pub fn property_with_default(name: impl Into<String>, default: f64) -> Self
Create a weight config that uses a specific property with a default value.
Sourcepub fn extract_weight(&self, edge: &Edge) -> GraphResult<f64>
pub fn extract_weight(&self, edge: &Edge) -> GraphResult<f64>
Extract the weight from an edge based on this configuration.
§Returns
Ok(weight)- The extracted weightErr- If the weight value is invalid (non-numeric)
Trait Implementations§
Source§impl Clone for WeightConfig
impl Clone for WeightConfig
Source§fn clone(&self) -> WeightConfig
fn clone(&self) -> WeightConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 WeightConfig
impl Debug for WeightConfig
Auto Trait Implementations§
impl Freeze for WeightConfig
impl RefUnwindSafe for WeightConfig
impl Send for WeightConfig
impl Sync for WeightConfig
impl Unpin for WeightConfig
impl UnsafeUnpin for WeightConfig
impl UnwindSafe for WeightConfig
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