error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in function call due to conflicting requirements
107 | let sub_iter = self.data.score_tree_iter();
The problem is from Vec<Par>. Really dont know how to solve this error.
pub trait Sortable<'a, ITER> where ITER : Iterator<Item = Node<'a>> + 'a
It means the lifetime of returned Iterator must be covered by the Node's lifetime and the struct implements Sortable, right?
In short, Sortable > Iterator > Node , where > means lifetime overlapps the later
Well, it means that you're declaring a trait that's generic over a lifetime 'a and a type ITER, and ITER cannot be bound by a lifetime shorter than 'a, and ITER also implements Iterator with an associated type of Item = Node<'a>. All 'a must be the same for implementations of the trait. Coercion will often see you through, but sometimes you need to give things separate lifetimes (or just not bind lifetimes) so that the bounds of one won't force the bounds of the other.