Skip to main content

Filterable

Trait Filterable 

Source
pub trait Filterable {
    type Root: Filterable;
    type Query;
    type FilterOptions;
    type SortField;
    type SortDetails;

    // Required methods
    fn query(
        page: Option<u32>,
        page_size: Option<u32>,
        sort: Option<Vec<Self::SortDetails>>,
        filters: Self::FilterOptions,
    ) -> Self::Query;
    fn into_root_query(query: Self::Query) -> <Self::Root as Filterable>::Query;
}
Expand description

The types #[derive(Filters)] generates for a root model or a mirror, so code mirroring it names them through it instead of by name.

Implemented by the derive.

Required Associated Types§

Source

type Root: Filterable

The root model of the chain: the model itself for a root model, the mirrored model’s root for a mirror.

Source

type Query

The query: paging, sorting and the filters (a root’s query model, a mirror’s query parameters).

Source

type FilterOptions

The filter options.

Source

type SortField

The sortable-fields enum.

Source

type SortDetails

The sort details: a sort field and its direction.

Required Methods§

Source

fn query( page: Option<u32>, page_size: Option<u32>, sort: Option<Vec<Self::SortDetails>>, filters: Self::FilterOptions, ) -> Self::Query

Build a query from its parts.

Source

fn into_root_query(query: Self::Query) -> <Self::Root as Filterable>::Query

Convert a query along the chain of mirrored models into the root model’s query (the query itself for a root model).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§