Trait django_query::ordering::SortVisitor
source · [−]pub trait SortVisitor {
type Target;
fn visit_sort<F, T, S>(&mut self, name: &str, field: &F, sort: &S)
where
F: Field<Self::Target, Value = T> + 'static,
S: SorterTypedClass<T> + 'static,
<S as SorterTypedClass<T>>::Sorter: 'static;
fn visit_key_sort<F, T>(&mut self, name: &str, field: &F, sort_key: &str)
where
F: Field<Self::Target, Value = T> + 'static,
T: Sortable + 'static;
}
Expand description
Something that can receive callbacks about the sort orders a type provides.
Each Sortable instance will accept a SortVisitor and describe to it the list of sorts it supports, using the provided methods.
Associated Types
Required methods
fn visit_sort<F, T, S>(&mut self, name: &str, field: &F, sort: &S) where
F: Field<Self::Target, Value = T> + 'static,
S: SorterTypedClass<T> + 'static,
<S as SorterTypedClass<T>>::Sorter: 'static,
fn visit_sort<F, T, S>(&mut self, name: &str, field: &F, sort: &S) where
F: Field<Self::Target, Value = T> + 'static,
S: SorterTypedClass<T> + 'static,
<S as SorterTypedClass<T>>::Sorter: 'static,
Receive a basic sort on a given raw Field, named name
.
The comparison operator itself is given as sort
.
Receive a key sort on a member field which is itself Sortable.
Here, name
is the name of the sort as usual, field
is the
accessor for the member, and sort_key
is the name of the
sort in the field’s own type which should be used.