If you have a
&str and a
Cow<str> you can call
Ord::cmp with the
&str as the first argument and the
Cow<str> as the second, but the other way around doesn't compile.
let s1 = "foo"; let s2 = std::borrow::Cow::Borrowed("foo"); // works dbg!(s1.cmp(&s2)); // doesn't compile dbg!(s2.cmp(&s1));
Is there a reason that it works this way? Or is there just an
Ord implementation that can and should be added to the standard library?