Trait slint::ModelExt

pub trait ModelExt: Model {
    // Provided methods
    fn row_data_tracked(&self, row: usize) -> Option<Self::Data> { ... }
    fn map<F, U>(self, map_function: F) -> MapModel<Self, F>
       where Self: Sized + 'static,
             F: Fn(Self::Data) -> U + 'static { ... }
    fn filter<F>(self, filter_function: F) -> FilterModel<Self, F>
       where Self: Sized + 'static,
             F: Fn(&Self::Data) -> bool + 'static { ... }
    fn sort(self) -> SortModel<Self, AscendingSortHelper>
       where Self: Sized + 'static,
             Self::Data: Ord { ... }
    fn sort_by<F>(self, sort_function: F) -> SortModel<Self, F>
       where Self: Sized + 'static,
             F: FnMut(&Self::Data, &Self::Data) -> Ordering + 'static { ... }
}
Expand description

Extension trait with extra methods implemented on types that implement Model

Provided Methods§

fn row_data_tracked(&self, row: usize) -> Option<Self::Data>

Convenience function that calls ModelTracker::track_row_data_changes before returning Model::row_data.

Calling row_data(row) does not register the row as a dependency when calling it while evaluating a property binding. This function calls track_row_data_changes(row) on the self.model_tracker() to enable tracking.

fn map<F, U>(self, map_function: F) -> MapModel<Self, F>where Self: Sized + 'static, F: Fn(Self::Data) -> U + 'static,

Returns a new Model where all elements are mapped by the function map_function. This is a shortcut for MapModel::new().

fn filter<F>(self, filter_function: F) -> FilterModel<Self, F>where Self: Sized + 'static, F: Fn(&Self::Data) -> bool + 'static,

Returns a new Model where the elements are filtered by the function filter_function. This is a shortcut for FilterModel::new().

fn sort(self) -> SortModel<Self, AscendingSortHelper>where Self: Sized + 'static, Self::Data: Ord,

Returns a new Model where the elements are sorted ascending. This is a shortcut for SortModel::new_ascending().

fn sort_by<F>(self, sort_function: F) -> SortModel<Self, F>where Self: Sized + 'static, F: FnMut(&Self::Data, &Self::Data) -> Ordering + 'static,

Returns a new Model where the elements are sorted by the function sort_function. This is a shortcut for SortModel::new().

Implementors§

§

impl<T> ModelExt for Twhere T: Model,