Skip to main content

Bind

Trait Bind 

Source
pub trait Bind {
    type T: Cursor + Clone;

    // Required methods
    fn sort_by(data: &mut Vec<Self::T>, is_order_desc: bool);
    fn retain(
        data: &mut Vec<Self::T>,
        cursor: <<Self as Bind>::T as Cursor>::T,
        is_order_desc: bool,
    );
}
Expand description

Trait for sorting and filtering data for pagination.

Implementors define how to sort items and filter by cursor position.

Required Associated Types§

Source

type T: Cursor + Clone

The item type being paginated

Required Methods§

Source

fn sort_by(data: &mut Vec<Self::T>, is_order_desc: bool)

Sorts items in ascending or descending order.

Source

fn retain( data: &mut Vec<Self::T>, cursor: <<Self as Bind>::T as Cursor>::T, is_order_desc: bool, )

Retains only items after/before the cursor position.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§