I want to make an instance of Ord, which compares my objects by struct field. Maybe I am missing something here
#[deriving(Eq, Clone)]
struct SortableLine<T>{
comparablePart: ~T,
line: ~str
}
impl Ord for SortableLine<~Ord>{
fn lt(&self, other: &SortableLine<~Ord>) -> bool{
return self.comparablePart.lt(&other.comparablePart);
}
}
This fails with
Thanks cannot call a method whose type contains a self-type through an object
Is there a way to make ordering of parent object based on ordering of a field comparison?