pub trait Field<R>: Clone {
    type Value;
    fn apply_sorter<V: Sorter<Self::Value>>(
        &self,
        op: &V,
        a: &R,
        b: &R
    ) -> Ordering; }
Expand description

Something that can apply a Sorter to a member of a type.

By asking the type to apply the operator, we can avoid cloning potentially large objects in more complex cases of nesting. If we used Accessor directly for everything, which is a much simpler definition, there are some constructs that we cannot handle efficiently, because of nested comparisons within members of type Option, for example (i.e. in the case that a Foo is to be sorted by the a member of a contained object of type Option<Bar>.

Associated Types

Required methods

Extract whichever member this Field obtains from R, from both a and b and apply op to the results.

Implementors