FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    SortExpressionComparer

    struct · ferroui-dynamic-data · v0.5.0

    struct SortExpressionComparer<T>
    

    A comparer of items by a list of keys, each ascending or descending (SortExpressionComparer<T>): the first key that differs decides.

    It builds as upstream's does, SortExpressionComparer::ascending(|p: &Person| p.age()) .then_by_ascending(|p| p.name()), and becomes the comparer that the operators take, Rc<dyn Fn(&T, &T) -> Ordering>, with comparer or into().

    View source

    Members

    ascending

    fn ascending<V: PartialOrd + 'static>(expression: impl Fn(&T) -> V + 'static) -> Self
    

    A comparer by expression, ascending (SortExpressionComparer<T>.Ascending).

    Source

    descending

    fn descending<V: PartialOrd + 'static>(expression: impl Fn(&T) -> V + 'static) -> Self
    

    A comparer by expression, descending (SortExpressionComparer<T>.Descending).

    Source

    then_by_ascending

    fn then_by_ascending<V: PartialOrd + 'static>(self: Self, expression: impl Fn(&T) -> V + 'static) -> Self
    

    The comparer, then by expression, ascending (ThenByAscending).

    Source

    then_by_descending

    fn then_by_descending<V: PartialOrd + 'static>(self: Self, expression: impl Fn(&T) -> V + 'static) -> Self
    

    The comparer, then by expression, descending (ThenByDescending).

    Source

    comparer

    fn comparer(self: &Self) -> Rc<dyn Fn(&T, &T) -> Ordering>
    

    The comparer as the function that the operators take (IComparer<T>).

    Source

    push

    fn push(self: &mut Self, expression: SortExpression<T>)
    

    Adds a key (Add, of the list upstream's comparer is).

    Source

    expressions

    fn expressions(self: &Self) -> &[SortExpression<T>]
    

    The keys, in order.

    Source

    compare

    fn compare(self: &Self, x: &T, y: &T) -> Ordering
    

    Compares x and y by the keys in order (Compare).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • Clone
    • Default
    • Debug
    • From<SortExpressionComparer<T>>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.