I have a vector of RTSPUrl and I want to find the smallest item.
struct RTSPUrl { /* fields omitted */ }
fn main() {
let rtsp_urls = std::vec::Vec::<RTSPUrl>::new();
let minimum_element = rtsp_urls.iter().min();
}
However the compiler complains that RTSPUrl should implement Ord.
error[E0277]: the trait bound `RTSPUrl: std::cmp::Ord` is not satisfied
--> src/main.rs:5:44
|
5 | let minimum_element = rtsp_urls.iter().min();
| ^^^ the trait `std::cmp::Ord` is not implemented for `RTSPUrl`
|
= note: required because of the requirements on the impl of `std::cmp::Ord` for `&RTSPUrl`
But this type isn't from my crate as it's generated by protobuf. Is there any other thing I can do?