I have a funny problem in ... I want to make a type I have sortable, so I have to implement PartialOrd.

Problem is, that the type itself does only store data that has to be processed to be sortable, but that might fail (Result<Option<>>).

How to make my type sortable?

@musicmatze You could choose to sort any "failed processing" last and have them all equal each other, if that's usable - the important part is that your ordering is consistent.

@musicmatze PartialOrd can return None when a comparison can't be done due to a failure.

Ideally you should compare cached Results, not a type which can inconsistently different return results during comparisons.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!