Skip to main content

ElementWeight

Trait ElementWeight 

Source
pub trait ElementWeight: TopologyBase {
    type Weight: Copy;

    // Required method
    fn element_weight(&self, element: Self::ElementId) -> Self::Weight;
}
Expand description

Optional total weight capability for topology elements.

A view implements this trait only when every visible element has a weight representation. The topology layer does not interpret the value: it is not a probability, cost, distance, count, or property name. Algorithms state their own numeric contracts when they consume a selected weight capability.

§Performance

Lookup should be O(1) unless an implementation documents a weaker contract.

Required Associated Types§

Source

type Weight: Copy

Copyable weight representation attached to each visible element.

§Performance

Values should be O(1) to copy.

Required Methods§

Source

fn element_weight(&self, element: Self::ElementId) -> Self::Weight

Returns the weight attached to element.

§Performance

Expected O(1) unless the implementation documents otherwise.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§