1 2 3 4 5 6 7 8 9 10
use std::ops::Add; pub trait Weight: Copy + Ord + Add<Output = Self> + Default { fn infinity() -> Self; } pub trait Weighted { type Weight: Weight; fn weight(&self) -> Self::Weight; }